07-25-2016 01:05 AM
Is it possible to automatically divide an array into smaller portions to find the local max and min? For example, the user could set a window size of 10 data points. This would divide the array into segments of 10 points each to be analyzed (specifically for max and min). This would mean that the number off subarrays would be dependant on the selected window size from the user.
I do have an idea of how this would be done using subarrays to manually divide the larger array into smaller seperate arrays, but this would require creating a set number of subarray functions. I would prefer to have the process be much more dynamic, and able to handle different data sets of different lenghts.
07-25-2016 01:20 AM - edited 07-25-2016 01:25 AM
Maybe using Split 1d Array inside for loop : http://zone.ni.com/reference/en-XX/help/371361M-01/glang/split_1d_array/
or decimate 1d array http://zone.ni.com/reference/en-XX/help/371361M-01/glang/decimate_1d_array/
Edit: decimate 1d array i am not sure how to change dynamically the length, may be someone else tried! and my suggestion will not be useful 😞
07-25-2016 07:53 AM
If the size of the starting array factors nicely (for example, if the size is 130 = 10 * 13), you could Reshape Array and turn it (temporarily) into a 13 x 10 array, feed it through a For Loop, and within the loop, process each of the 13 10-element sub-arrays ...
If it turned out to not be conveniently factorable (127 elements, for example), you could "pad" it with (say 3) extra elements, possibly NaN or Inf (if dealing with Dbls), or otherwise figure out how to deal with the "end" short array ...
Bob Schor
07-25-2016 09:53 AM