03-10-2011 09:57 AM
I'm pretty new to LabVIEW and am trying to show a cluster of 91 values pulled from a text file. Just for a test run without using actual values passed, I created a text file with the numbers ranging from 1-91 (1 number per line up to 91). When I let it auto index and try to unbundle it after transforming it from an array to a cluster, it only shows 9 values instead of 91. Do you happen to know how I can overcome this issue?
I have attached the basic files.
Solved! Go to Solution.
03-10-2011 10:09 AM
you need to right-click your 'array to cluster' and select 'cluster size...' from the menu. Set it to 91. It's currently set to 9.
Sebster.
03-10-2011 10:10 AM
Hello,
Not sure why you want to convert the array to a cluster... but you need to right click on the array to cluster and select cluster size, whereby you chnage that value to 91 instead of the 9 that is there by default.
03-10-2011 10:17 AM
Thank you very much, I had no idea that you could select a cluster size from the transformation. I am converting it to a cluster because I thought that it would be the best form to insert the data into different parts of a word template. I am trying to build an auto reporting tool for a test sequence.
03-10-2011 10:26 AM
To extract a fixed number of elements from an array you can use a single Index Array node and enlarge it vertically until you expose the correct number of outputs. By wiring indexes from the left you may also select a specific extraction order; if you don't wire values as indexes, elements are extracted sequentially.
03-10-2011 01:24 PM - edited 03-10-2011 01:24 PM
You need to set thee cluster size, because clusters are static structures and the size needs to be known at compile time. This also makes them useless for your problem.
@STigmata08 wrote:
Thank you very much, I had no idea that you could select a cluster size from the transformation. I am converting it to a cluster because I thought that it would be the best form to insert the data into different parts of a word template. I am trying to build an auto reporting tool for a test sequence.
To extract all lines from a file, you could use Spreadsheed string to array with a 1D string array as type and linefeet as delimiter. No need for FOR loops and complicated code. Also your sequence structure has no purpose because execution order is fully determined by dataflow anyway. Why is it there? Don't clutter the diagram with useless constructs!
Here's what you could do. You can get any element, array subsets, etc. using array tools. These are scalable and you don't need to know beforehand how many line are in the file.
Here's a quick draft (LV8.6)...
03-10-2011 01:28 PM
Using clusters as a means of indexing an array is putting yourself into Rube Goldberg territory.
http://forums.ni.com/t5/BreakPoint/Rube-Goldberg-Code/m-p/772709#M6492
03-10-2011 01:57 PM - edited 03-10-2011 02:00 PM
The reason why I am doing it this way is because I am writing the 90+ values to a .dotx for reporting. After building the template, I will have the values writen from the tests to a .txt file since passing so many random variables would be a pain to pass. Then, after reading the .txt I will have each line passed into the various bookmarks that I created in the template. I know it sounds like a lot of work but with me being new to all of this, it seems easier to do since I can manipulate each step to do what I want.
Edit:
The reason that I am using the For Loop is for it to use the iteration terminal to pass the line that I need, in the order that it is loaded. Maybe I did do it a more complicated way and should modify it by making a cluster in my main program and just passing that cluster on.
03-10-2011 02:16 PM - edited 03-10-2011 02:24 PM
None of what you are saying points to the use of a cluster.