05-28-2014 04:40 PM
Would it be possible to store data such as
1 2 3 4 5 6
0 2 4
3 1 4 1 5 9 2 6 5 3 5 8 9
Where each row is not nessicarly the same length. I need to later call a specific row by row number and plot the 1D array. I have figured out arrays wont deal with the non uniform length and will instead fill in the extra elements so they all match in length. Is there any way around this?
Thanks
05-28-2014 05:15 PM
Place the arrays in a cluster. Then make an array of the clusters. The array of clusters has only the cluster containing the array of numerics. The individual arrays of numerics can have different lengths.
Lynn
05-28-2014 10:13 PM
you can take a 2D array and during plotting of data you can index any row and then delete the empty elements from the array before plotting.
05-28-2014 11:00 PM
05-29-2014 11:14 AM
The issue is that I'm making the arrays in a loop and I cant find a way to insert an array into a cluster instead of building a cluster from multiple predefined arrays.. If that makes sense.
I need something much like the insert into array function except for clusters. Maybe I'm missing a way to do that.
05-29-2014 11:48 AM
You can simply connect the arrays to a Bundle node.
Look at this VI which demonstrates the concept.
Lynn
05-29-2014 11:51 AM - edited 05-29-2014 11:51 AM
Let's assume you have two stacked FOR loops, generating a scalar in the center. Auto indexing across both loop boundaries would give you a 2D array. If the number of iterations in the inner loop is variable and you want a ragged array, insert a"bundle" of height=1 between the two output tunnels.
05-29-2014 12:11 PM - edited 05-29-2014 12:12 PM
For Posterity, here's one of Darren's nuggets on the subject, the thread has a decent conversation on this handling jagged arrays:
http://forums.ni.com/t5/LabVIEW/Darren-s-Occasional-Nugget-05-09-2012/td-p/1984521
Note that the suggestion there is more or less what Lynn suggested.
Regards,
05-29-2014 12:21 PM
I had to make a few adjsutments so it would work with shift registers and I had to make sure to connect the terminals into the insert array function in the right order so the connections would be valid but now it works. Thank you. I included the changes.
05-29-2014 12:35 PM
It is generally better to use Repalce Array Subset or autoindexing to build an array. Insert into Array may cause memory allocation problems. Here are two mnodifications to your VI which show both methods. If you need to see the results as you go, the Replace Array Subset is best. If you do not need the data until the for loop completes, autoindexing is the preferred choice.
Note that you may need to initialize your shift register. Run the VI multiple times and watch the results.
Lynn