LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to limit size of an array?

Solved!
Go to solution

Here's what I would do to get either the first N or the last N Atl records. Pick what you really need and delete the rest.

 

altenbach_0-1660841964857.png

 

0 Kudos
Message 31 of 36
(870 Views)

@BrianK75 wrote:

I was finally able to limit the number of desired records from an array using a for loop and an Insert into Array.vi

 


While the rest of the code is very convoluted too, the "insert into array" is completely pointless, pure Rube Goldberg, and not needed here.

 

Here are two possible alternatives that give the exact same result:

 

altenbach_0-1660842614311.png

 

Message 32 of 36
(864 Views)

Sorry for the delay.  This is what you asked for.  I deleted all of the Report Generation Toolkit (Excel) VIs.

0 Kudos
Message 33 of 36
(840 Views)

Thanks. I think I already solved it for you. Have a look here above.

 

(Next time, also provide a typical default value for the numeric control. A default value of zero is not typical and would not require any code at all to generate the output. 😄 )

 

0 Kudos
Message 34 of 36
(830 Views)

Thank you!

Very true.  I normally have defaults set in my code.  However, this particular piece was going to be a list of ever changing information.  I guess a default controal array is just as good as any list to work through the sorting and filtering aspect of things.

0 Kudos
Message 35 of 36
(823 Views)

Note that my solution works mostly in-place and does not allocate memory for the subarray of all Atl records and other intermediary data structures. Even the sorting by date could be implemented with a tiny amount of extra code.

0 Kudos
Message 36 of 36
(802 Views)