From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create subarrays of sequential integers?

Solved!
Go to solution
Tdarkins, I meant an array of clusters, not a cluster of arrays. The cluster contains one element - an array. You create an array of these clusters. No need for typedefs or bundle by name. Just bundle and unbundle the single element. It is an easy workaround for the lack of support for sparse arrays in LabVIEW.
=====================
LabVIEW 2012


0 Kudos
Message 11 of 21
(707 Views)
Solution
Accepted by Pladio

Ok, I am back on a computer with LabVIEW. The thing about LabVIEW is that a picture tells a thousand words.

 

This is what I was getting at. Also attached in LV8.2.

 

Array of Arrays_FP.png

 

Array of Arrays_BD.png

=====================
LabVIEW 2012


Message 12 of 21
(699 Views)

Yes, that's exactly what I would want it to do. Basically, split the arrays into several subarrays that have all the information in them.

 

Well, either that or immediately process the information by then also going through the supposed subarrays and finding out which of those numbers (which correspond to indices of another array) is the largest in value.

0 Kudos
Message 13 of 21
(673 Views)

Would working with a whole bunch of arrays in clusters make it harder to process the data later than just having an array ?

 

How would you go about making this into a 2D array instead of clusters 

It just seems to me that working with arrays is easier ...

0 Kudos
Message 14 of 21
(672 Views)

Hi again,

 

I think I managed to make it work. Mind taking a look ?

 

 

0 Kudos
Message 15 of 21
(668 Views)

What you have is a 2D array which might be fine. It will only cause a problem if you can ignore the number 0. As long as you don't have any sequences that start with 0 you should be fine. You can make another subVI that takes a row in and returns an array containing everything up to the first 0.

 

As for arrays of clusters of arrays, there is no problem with performance. It is only slightly inconvenient that you have to index followed by unbundle.

=====================
LabVIEW 2012


0 Kudos
Message 16 of 21
(664 Views)

How would I go about choosing which of the bundled array to use though ?

For a 2D array I know I can do two for loops and just let the for loop automatically index the arrays. For a bundle of arrays, I would need to know how many there are or not ?

0 Kudos
Message 17 of 21
(661 Views)
You just wire the array of clusters to a for loop like any other array. Inside the loop you unbundle the single element. This gives you a 1D array (your "subarray") that you can process how you want to.
=====================
LabVIEW 2012


Message 18 of 21
(658 Views)

Hi, thanks to both Steve and TD for helping me out. It's been very useful and enriching 🙂

 

Is it possible to pick two solutions as I've mixed both of your inputs into a mish mash ?

 

 

0 Kudos
Message 19 of 21
(650 Views)
Glad you got it working. You can only pick one reply as the solution though.
=====================
LabVIEW 2012


0 Kudos
Message 20 of 21
(642 Views)