Showing results for 
Search instead for 
Did you mean: 

queue in image transmission

Dear Member,


I need a help in my problem..


I'am implementing image transmission using USRP with labview, I want to use queue in my code to transmit the image parts., In the transmitter, I used producer/consumer template but my problem is how to specify the size of the dequeue data to read each loop?

0 Kudos
Message 1 of 10

Well, if you had attached your VI (not a picture of your code, but the actual VI), we could see exactly how you created the Queue, and could explain that when you create the Queue, you define what gets put on and taken off.  In particular, if you define a Queue of "Array of Dbl", you can put any "Array of Dbl" on the Queue, and you will dequeue (are you ready for this?) ... an Array of Dbl.  How big an Array?  The exact same size as you put on the Queue.  [Note I've not yet explicitly tested this, but would be shocked and dismayed if this turned out to be false ...].  Thus you can Enqueue an Array of 10 Dbl followed by an Array of 10000 Dbl followed by an Empty Array (a.k.a an Array of 0 Dbl) and you'd dequeue Arrays of size 10, 10000, and 0.  Indeed, I use an Array of 0 as the last element I put on a Producer/Consumer Queue to signal to the Consumer that the Producer has exited and no more data will be coming, allowing the Consumer to exit and Release the Queue (avoiding a spurious "Error" condition in the Consumer if the Producer releases the Queue (a bad design decision, in my opinion).


Bob Schor

0 Kudos
Message 2 of 10

Thank you for your explanation,


In the attached figure, the maximum data size which can be accepted by MIMO-OFDM Tx block is 2x8256 and my image data that I want to transmit is 2x131072.

in this part I want to add queue so I can dequeue only 2x8256 to MIMO-OFDM Tx block each loop and then transmit and so on but what I did is not working.


Is the way Iam thinking right ? what is your opinion..and how to dequeue only specific part of the data each loop..

0 Kudos
Message 3 of 10

here is the figure

0 Kudos
Message 4 of 10

I refuse to look at pictures of LabVIEW code because:

  • They are generally too small, and I can't read the tiny type.
  • I can't "manipulate" the code, like moving blocks and wires so that the "Data Flow" is obvious to me.
  • I can't inspect Case statements, Express VIs, etc. to see the "hidden details".
  • I can't tell what version of LabVIEW you are using.
  • I can't edit the code.
  • I can't execute, or try to execute the code.

I see you have a function circled in the picture.  I can't read its icon to tell what it does, don't know its inputs or outputs, etc.


My suggestion is that you compress the folder containing this VI and the other elements of this Project, and attach the resulting .zip folder.  Tell us (in words) what function you'd like us to inspect, and what sub-VI inside that function you think is throwing an error or giving you trouble (and describe the error/trouble).


Help us to help you.


Bob Schor

0 Kudos
Message 5 of 10

Thank you for your reply,

actually, I discover that queue option will not solve my problem because the dequeue loop will have the same size of the queue loop as you mention this earlier but this will not work with me..if I told you what I need in different way. I have array 'A' with size of 2x8256 and let it be for example [1 2 3 4 5 6 ......;7 8 9 10 11 12 .....], I want to create for loop with output array 'B' with size of 2x516 in such away the first iteration will take the first 2x516 values from A and the second iteration will take the second 2x516 values from A and so on, in other way I want to process each part of A separately by having only one output array B of size 2x512 and it will keep updated each iteration.


My files are huge because there is matlab scripts and functions and subvi, i will try to compress it and upload it in such away i will not miss any file and it should be run using ni-usrp 

0 Kudos
Message 6 of 10

We really need to see the code, as I don't understand your explanation.  At first, I thought your numbers were "wrong", as you mention an array of 2 x 8256, then described processing it in "chunks" of 2 x 516.  My immediate thought was "Oh, you mean 2 x 512, as 516 doesn't go evenly into 8256", but I was wrong -- you can reformat a 2 x 8256 array as 16 * 2 * 516.  But then you mention Array B as 2 * 512, and 512 is not the same as 516, so what's going on?  I hope seeing the code will help (maybe there's a 4-byte "size" element somewhere ...).


Bob Schor

0 Kudos
Message 7 of 10

Can you check the code, for example I have A=[ 1 3 5 7 9 11 13 15; 2 4 6 8 10 12 14 16]

I want B to be in the first iteration [ 1 3; 2 4] , in the second iteration [5 7; 6 8], in third iteration [9 11;10 12] and so on but for my code is not giving me this. how I can do this and how I can do increment for i in the loop.

0 Kudos
Message 8 of 10

Your code is just adding 1 and subtracting 1 from i.


You need to multiply by 2.


0 Kudos
Message 9 of 10

Wow, what a fun problem!  Thank you for helping me find the way by providing a "numbered" A Array.  I realized that you were basically "reshaping" the Array, and wanted to take a 2 x 8 Array and turn it into a 4 x 2 x 2 Array, where the first 2 x 2 was [1;3] [2;4]].  What I (momentarily) forgot was that LabVIEW really likes to process "by rows", but a little experimenting set me straight.


The first step is to convert the 2D Array in to a 1D Array with the indices in order, i.e. [1;2;3;4;...].  This is a two-step process -- since we want the rows to be in numeric order, and the input array is ordered by columns, a 2D Array Transpose changes the Array to an 8 x 2 Array, [[1;2] [3;4] ...].  Now we can reshape it as a 1D Array.  To do this in the most general way (i.e. without "knowing" that there are 16 elements), we take the Size of the Array (2, 8), multiply them, and use this with a Reshape Array to get a 1D Array.  We now want to create 4 2 x 2 Arrays out of this -- another Reshape Array.  Again, we know the last two sizes (2, and 2), and can compute the number of these small sub-arrays by dividing the size of the 1D Array by (2 x 2).  We wire these three numbers into the final Reshape Array.  Now we are almost done -- we have 4 sub-Arrays, but they are in row, not column, order.  Passing the 3D array through a single For Loop, inside of which we again transpose the inner 2 x 2 array, gives the final desired result.


From the above description, you should be able to re-create my VI.  Doing so will acquaint you with the Size, Transpose, and Reshape functions -- feel free to utilize the LabVIEW Help function to get details on these functions.


Bob Schor

0 Kudos
Message 10 of 10