LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Data from LabVIEW over TCP to read in a C Structure

Solved!
Go to solution

Thank Rolf!

 

I interpreted "Then you have a cluster of 64 LabVIEW strings instead of a cluster of 2 * 128 clusters of 64 U8 elements." as shown in the modified subvi code below.  If this is correct, then I am too much worried about the SUPER BIG output cluster. Haven't tested it yet.

 

In case I still failed to understand, may I request you to modify the attached code and share (extremely sorry for this). Thanks in anticipation.

 

subvi.PNG

0 Kudos
Message 11 of 14
(765 Views)

Assuming your strings are never more than 63 bytes long, there's no need to add the explicit null byte, because the arrays are already initialized to null (0). Every byte after the ones you replace will be null. Rather than doing all this work with Replace Array Subset, you could simply take each string, do String to Byte Array, then Reshape Array to resize it to a length of 64. Again, all the extra bytes will be initialized to null (0).

 

Also there is no need to do an explicit Index Array inside the for loop. Move the array of strings control outside the for loop, resize it to 128 elements, and autoindex it.

0 Kudos
Message 12 of 14
(759 Views)
Solution
Accepted by topic author ITA

This is one way to do it:

 

data packet.png

 

Just don't add the resulting string to the cluster that is flattened again but instead flatten the rest seperately and then concatenate them together. And yes the explicit indexing is needed unless you ALWAYS can guarantee that there are at least 128 elements in both incoming arrays.

Rolf Kalbermatter
Averna BV
LabVIEW ArchitectLabVIEW ChampionLabVIEW Instructor
Message 13 of 14
(744 Views)

Thanks a lot Rolf and sorry to bother you.

 

The code with SUPER BIG cluster and the one you attached both are working. I guess the vi that you attached is much better in terms of performance.

 

Thank you again!

 

 

0 Kudos
Message 14 of 14
(731 Views)