LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert 2D-Integer-Array to String

Dear all,

I'm using two while loops conected via a queue for data aquisition in the first and data analysis in the second loop. I get a 2D array of binary data out of the data aquasition, but the queue elements want to have a string! So far I'm just using the first element of the array (item 0), convert it to a string and send it to the queue. But with this I throw valueable Data away, but if I use a loop to convert every item of the array to a string than the repetition of the main data aquisition loop slows down and the buffer of my DAQ-board run over, loosing data, because there can be up 3000 data points per one reading of the buffer!
I know, that you can convert an array of numbers to an array of string with the "Number to S
tring"-function, but than you still have an array that the queue do not accept.
Is there a way to convert an array as discriped without using a loop or losing to much time!
(Well, so far I use a dual-pentium III system with 550MHz and I think it be enough processor-power for this, or?)
0 Kudos
Message 1 of 6
(3,432 Views)
Hi
Do you use LV 6.1?
In LV 6.1 The Queue Function can accept any type of data. The way you configure is this..

Use the "Obtain Queue" Function. Wire your Incoming data to "Data type" terminal on this Function. Now you wire the ref out of "Obtain Queue" to your "Enqueue" and "Dequeue" Functions. They will accept this data.

If you are using LV 5.1 then you can Use "Flatten to String" Function under the Advanced->data manipultion palette to convert to string and then use "Insert Queue Element" You can use "Unflatten from String" to do the opposite process.

Do you need to still do the array Operation? I guess not..

Good Luck!!

Mache
Good Luck!

Mache
0 Kudos
Message 2 of 6
(3,432 Views)
Hi Mache,

thanks for your answer!
I use LV 6.0.2, but it seens to be worthy to upgrade to LV 6.1.
Well, I tried the "Flatten to String" function, but it doesn't work on complete array, or?
If I convert a complete array with dbl into a string and back, than the values are not the same. Even, if I connect the type string output and input together!
Or is there a trick I don't know with this "Flatten to String" function ?

Stephan
0 Kudos
Message 3 of 6
(3,432 Views)
Hi Mache,

well I tried your suggestion again seperating the items with a loop. Than it is working!
But my problem is not to use a loop to seperate the items, but to convert the whole array in one step. If I would use a loop for converting the data during my DAQ than my buffer overruns!

Stephan
0 Kudos
Message 4 of 6
(3,432 Views)
Try using the "Cast" function if your Queue is truly using Strings as input.

The purpose of the Queue function was primarly to send messages from one point to another, not really to send data.

I would suggest taking a look at your design, and possibly rethinking it. Queues are probably too slow for what you want. A simpler (though riskier) method may be to use references, though I would suggest using a data object, such as is described in the Topic: Programming Designs Discussion and Sample Code on this forum.
Message 5 of 6
(3,432 Views)
Thanks a lot,

the "Cast" function works !
0 Kudos
Message 6 of 6
(3,432 Views)