07-24-2013 08:43 PM
Hi , could you please help me with this. Lets say I have this array
01001
and I want to replace each 1 and 0 with 2 ( might be 10000) number of0s and 1s. so the result is
0011000011
Could you please help me to implement this in LV . As mentioend I should be able to repeat the bits as many time as specified . 2 times or 100000 times
Thanks
07-24-2013 09:30 PM - edited 07-24-2013 09:31 PM
This sounds like homework, but i'll give you a hint -
You need to iterate through the array and create a seperate array based on the individual elements. To do that, you'll need a for loop, a case structure, initialize array, and build array.
You should be able to take it from here...
07-24-2013 11:31 PM
VI Attached. Pretty easy logic to claim help :[ I would suggest u to learn LabVIEW fundamentals. Read the help context and pratice with examples already shipped. 🙂
07-25-2013 01:50 AM
@p-rose wrote:
...To do that, you'll need a for loop, a case structure, initialize array, and build array.
Two for-loops will do, actually
07-25-2013 02:25 AM
Or you could just interleave the array with a copy of itself. See attachment.
07-25-2013 07:27 AM - edited 07-25-2013 07:27 AM
I would use Initialize Array.
07-25-2013 09:19 AM
Or, if you want to be fancy, turn the digit array into a string, use search-and-replace (2X) to add your digits, then turn the resulting string back into a number array.
Cameron
07-25-2013 09:52 AM
Most cleaner and simple solution has been posted by crossrulz