I'm currently working with a program that builds an array of 3000*N real numbers, where N is a control that I specify. I want to pass this array into a for loop that runs N times, each time splitting the first 3000 numbers of the array. So, in other words I want the for loop to execute enough times such that the initial array will be completely divided into groups of 3000 when I'm finished. Later I'll be finding the maximum value of all of these subarrays and taking the average of those. What I tried first is to pass the array into the for loop, then truncate it at index = 3000, but the problem is that I can't hard code the loop to do this N times. Any advice or other methods you'd recommend for doing this?
Is there a particular reason you aren't doing this using a 2D array?
If you stick with a 1D array than you can always divide the total length of the array and calculate your value of N. Then you can use a nested FOR loop with the outer loop running N times and your inner loop running 3000 (or whatever size you need) times. Use a shoft register on (on both loops) to keep track of your current index into the 1D array.
Attached is an example of what I think you need.
Mark--I don't think I can use that approach. Let me be more specific on what the problem is:
Our "big program" is a giant while loop that constantly reads in voltage values from a DAQ assistant.
It has two modes, the first of which I'm having a lot of trouble with. This mode uses a for loop (N = 3000) nested within the giant while loop.
When the for loop activates, the DAQ assistant takes reads 300 samples for every iteration and takes the maximum of those 300 values. It then builds an array composed of all the maxima. After the for loop has executed 3000 times, a case structure activates, which then finds the maximum of the array of maxima.
I want this (N=3000) for loop to execute an arbitrary number of times, a number that I will specify. Each of those times it should generate a completely seperate array of maxima. So, if I want the for loop to run 5 times, I want 5 different arrays.
My approach for doing this was to change N=3000 to say N = 15000, then split up the resulting array 5 times. So, I need an entirely separate for loop that reads in this array of 15000 maxima on its own and splits it 5 ways. I think what you're suggesting is to use a for loop outside of the N=3000 loop, which is a good idea in theory, but experience has shown that this will not generate 5 separate arrays. It will actually concatenate each array into one, hence the problem we currently have.
Yik--I won't have access to Labview over the weekend. Is it possible to take a screenshot and post it, or maybe a short description?
Thank you for the responses.
Attached is a picture version.