LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I cannot unpack lines read from a file

Solved!
Go to solution
I have created a VI based on the Read VCard VI in the LabVIEW Basics I manual. I am using a for loop to read 15 lines from a file into an array.  If I simply add an indicator, as done in the Read VCard VI, I see all 15 lines. However if I convert the array to a cluster and try to unpack it I only get nine values.
0 Kudos
Message 1 of 3
(2,246 Views)

The array to cluster node defaults to 9 elements.  Context-click on it and specify the number of elements.

 

Lynn 

0 Kudos
Message 2 of 3
(2,245 Views)
Solution
Accepted by topic author wames

It is fundamentally incorrect to use "array-to-cluster" followed by "unbundle" to unpack (your words!) the elements of an array. Why would you take the detour over a completely different data structure??? 😮

 

The correct way is "index array", it can be resized to any number of elements (and also allows you to only pick certain specific elements if you would wire the index.). There is no need to jump through flaming hoops such as using multiple primitives and specifying the cluster size.

 

If the first index is unwired it defaults to zero. Any other unwired index defaults to +1 of the index terminal above it. So, if you don't wire any indices, you'll get 0,1,2,3,4.... If you would wire the second index with a 5 , you'll get 0,5,6,7,8... depending on the size of the node. Simple! RIght?

 

Of course many times you just want to see all elements of a small array. In this case you would use an array indicator directly. No code needed! 🙂

 

Array to cluster is used for example if you want to place the data on a chart with N channels.

Message Edited by altenbach on 11-07-2008 12:13 PM
Message 3 of 3
(2,232 Views)