From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Do I have to dequeue each element separately?

I have a series of arrays (hopefully in the attached vi is the right one) and a single dequeue for them all to a tdms write in my consumer loop. The problem im having is that im not getting all of the data into my tdms file. Only chunks of it. Why is that? Dequeue appears to only remove the last element, so does that mean I need like 50 dequeues and 50 tdms writes each with their own channel name in order to get all my data?

0 Kudos
Message 1 of 32
(3,479 Views)

You need to have one dequeue for each enqueue to get all the data. You are enqueuing three times to the string array and five times to the numeric array in each iteration of the bottom loop.  In the top loop you dequeue three times from the string array and once from the numeric array.

 

Let's make a little example:

 

First iteration of lower loop:

String Queue:  1a, 2a, 3a

Numeric Queue: 1x, 2x, 3x, 4x, 5x

 

First iteration of upper loop:

Removed from String Queue:  1a, 2a, 3a.  Remaining in String Queue: -

Removed from Numeric Queue: 1x. Remaining in Numeric Queue: 2x, 3x, 4x, 5x

 

Second iteration of lower loop:

String Queue:  4a, 5a, 6a

Numeric Queue: 2x, 3x, 4x, 5x, 6x, 7x, 8x, 9x, 10x

 

Second iteration of upper loop:

Removed from String Queue:  4a, 5a, 6a.  Remaining in String Queue: -

Removed from Numeric Queue: 2x. Remaining in Numeric Queue: 3x, 4x, 5x, 6x, 7x, 8x, 9x, 10x

 

As you can see, the size of the Numeric Queue will continue to grow. 

 

WIthout spending much time looking at your code, my first thought is to an create array of the strings and enqueue that array. Similarly either concatenate the numeric arrays or make a 3D array and enqueue that. One enqueue for each type of data. One dequeue for each type of data. You might need to do some parsing before writing to the file.

 

Lynn

Message 2 of 32
(3,452 Views)

One other thing: Give your indicators unique names. Eight graphs named "1" is very confusing. If the users need to see "1" on each grpah on the front panel, use captions. The graphs could be g1, g2, g3, g4, g5, g6, g7, g8. Then the terminals and property nodes will all have different labels so you can tell what is connected to what. 

 

Lynn

0 Kudos
Message 3 of 32
(3,447 Views)

interesting, i was not aware that was how it worked, i thought it jsut queued the data stream in the order received from the array. What do you mean a 3D queue? Also the reason I have it set up this way is that I want the event marker number and descrip to be the last columns of my excel spreadsheet and all the data to precede it in the previous columns.

0 Kudos
Message 4 of 32
(3,439 Views)

On my working copy I have them with separate names this was just the test of the structure to post here for help. but i appreciate it!

0 Kudos
Message 5 of 32
(3,438 Views)

Flush the queue in the writer.  You will get an array of all enqueued elements and can write them all at once with a bit of reformatting


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 32
(3,435 Views)

I tried the flush queue, (the one with the trash can icon right?) and it would not write to tdms. Kept getting the polymorphic data cant accept this error on the wire no matter how hard I tried to resolve it.

0 Kudos
Message 7 of 32
(3,431 Views)

send me some code.  Again, you may need to wash the array of queue data through a loop with concatinating outputs but, Flush is the way to go.


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 32
(3,422 Views)

@JÞB wrote:

send me some code.  Again, you may need to wash the array of queue data through a loop with concatinating outputs but, Flush is the way to go.


What does this mean? I can post updated code tomorrow morning.

0 Kudos
Message 9 of 32
(3,416 Views)
I tried to make a 3d array but get an error stating that the enqueue input is 2d only
0 Kudos
Message 10 of 32
(3,359 Views)