11-16-2015 07:00 AM
I have an array that has single values of elements such as [1,2,3] and I want to convert it to the format [1,1,2,2,3,3]
I'm trying to use a for loop with 2 counts but for some reason it says that I have too many dimensions.
Attached is my image.
Solved! Go to Solution.
11-16-2015 07:26 AM
Learn about For loops, indexing terminals (on the input side, they allow you to "step through" your array one element at a time, while on the output side, they "construct" an array for you). This will certainly be covered in the LabVIEW tutorials available for free (except it does cost a little time and effort on your part).
Let me paraphrase your problem in a way that should suggest a simple (and extremely efficient) solution:
For every element of the input array, put two copies into the output array. Hint -- you can do this with a single For loop with one other LabVIEW function (guess from which Palette) inside the loop.
Bob Schor
[Colleagues -- please let ylevental try to figure this out -- this is the best way to learn ...]
11-16-2015 07:38 AM
There is a simple primitive, Interleave 1D array that would do that for you.
Hope that works!
11-16-2015 07:51 AM
Thanks! I didn't even know this existed before you showed me 😄
11-16-2015 07:57 AM
No problem, there are so many functions in LabVIEW that its extremely hard to keep up, if not impossible!
God Bless!