04-13-2020 08:08 PM
I'm looking for a way to extract first n elements from a 1D array into another array and build into a new array with the extracted elements (i.e extracting first 3 elements, then second 3 elements, and so on and building respective arrays).
Any suggestions? Thanks y'all
Solved! Go to Solution.
04-13-2020 08:45 PM
It is easiest if you would attach a small Vi with typical inputs as default values and expected output.
Your words are ambiguous. For example, what is "extract"? Copy the subarray out? or remove the extracted elements from the original array.
One possible solution is "reshape array" i.e. reshape into a 2D array with three columns. Then you can index these columns out if needed. Is the array size divisible by three?
04-13-2020 08:57 PM
@altenbach wrote:
One possible solution is "reshape array" i.e. reshape into a 2D array with three columns. Then you can index these columns out if needed. Is the array size divisible by three?
Here's what I had in mind. As I said, it's not really clear what you want, so please clarify further.
04-13-2020 09:07 PM
So I have attached a VI of 1D array with 12 inputs, but I don't know how to put random numbers in the 1D array.
I'm trying to copy a subarray out intervals. In the actual problem, the array would be 168 elements trying to subdivide into 7 arrays of 24 elements each. Sorry if I don't use the right words, I'm really new to labview.
Thanks for all your help. I really appreciate it
04-13-2020 09:34 PM
You don't mention your use of "mean". Do you want to average N consecutive elements?
Here's one possibility:
04-13-2020 09:42 PM
Sorry, I did want to average the N consecutive elements, but I wasn't how to make possible. How do I create that "set of three" indicator? I'm not sure what is the output is either.
Thanks
04-13-2020 10:55 PM
you don't need that indicator, I just renamed what you already had there. It will display the currently processed three consecutive elements, but the loop will run so fast that you won't see anything interesting.