04-28-2011 11:19 AM
Hi folks!
I am having a little trouble with what is probably a very simple matter.
I know there is a vi to interleave 1D arrays.
However, I have two arrays being built within a For Loop and I want to interleave them to the various iterations.
These arrays are data from the "Read Analog Input" for multiple samples and multiple channels in the 1d Waveform format.
It's important that the data is indexed, because the order and the data from all the iterations matter.
I have tried various codes but to no success.
Can anyone point me in the right direction?
Cheers.
04-28-2011 11:43 AM
Hey there,
A bit more clarity on what you mean by "interleave them to the various iterations" might help.
Sounds like you have two 1D arrays of Waveforms, and you want to sort of repackage the waveforms in those arrays on certain iterations?
One idea might be to do this outside of your FOR loop if that's possible/reasonable for your application. The idea being you'd index out and post-process the arrays to build the final structure/array you need.
In your FOR loop, perhaps you'd only keep track of the indicies of those two arrays that you need to "remember" in order to post-process accordingly.
Does that help?
04-28-2011 11:56 AM - edited 04-28-2011 12:00 PM
I do not understand what problem you are having...
Have you looked at the context help? (it's in the yellow box within the code snippet)
Look at the example code (snippet) to show how interleaving works.
04-28-2011 12:25 PM
@ Ray.R : I appreciate the effort but I understand the concept of interleave, however I was trying to implement it to two 1D Waveforms inside a "For Loop". But I guess is best to follow JLS suggestion.
@JLS: Thanks for your input, I was coming around to that idea. It's a more simpler code and outside the loop I can manipulate it at will.
Thank you both.
Cheers!
P.S.: If anyone has a solution please post for future references.
04-28-2011 01:11 PM
Great, glad that helped a bit!
To a bit more detail in that regard, you could keep track of the interleave indices of each array, and perhaps which array to start with (compute a boolean, if for some reason this changes between runs of your app).
The idea being you'd have two arrays of indices, each marking the "interleave points" for its respective array.
The post-processing routine then would use those "index arrays" and the Array Subset function to strip off the relevant subsets of the two arrays and piece things together the way you'd like. Probably doing that in a FOR loop which would input-index either or both of the "index arrays."
Admittedly, that's a sort of "high level" description without thinking all the way through the details. But I think something in that regard would be pretty straightforward to implement.
Hope this helps a bit more!