LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shifting the rows of a 2D array

Solved!
Go to solution

Hello evryone!!

I have a 2D array called message which looks as in the VI attached.

example: 11011001

                10011011

 I have another 1D array called shifts which generate random numbers from 0-5 for the number of rows in message..

example: 2 5

 

I now have to creat a 2D array, each row having the size of message+maximum (shifts array)

And into each row of this 2D array, I have to input a row of the message array starting at the corresponding value given by the shifts array as index. if the shift value is not  maximum i.e 5 in this case, the rest of the values have to remain zeros.

 

Example: 0 0 1 1 0 1 1 0 0 1 0 0 0

                0 0 0 0 0 1 0 0 1 1 0 1 1

 

Any suggestions as to how to do this? Thanks!!

 

0 Kudos
Message 1 of 3
(3,221 Views)
Solution
Accepted by topic author LSASS

Creating such a 2D array has a problem.   conside a shifts 1D array like this 2 5 1.  So your 2D aray will be like this:

msg array:

11011001

10011011

10101011

 

0 0 1 1 0 1 1 0 0 1 0 0 0

0 0 0 0 0 1 0 0 1 1 0 1 1

0 1 0 1 0 1 0 1 1 0 0 0 0

 

The last 4 zeroes are not part of the msg but will show as if its part of the message.  Is this condition taken care in your code?  (Stil this can be handled by using the shift value and length of the message block.  Is your message block constant? )

The vi attached does the task you hav describedSmiley Happy

 

Message Edited by JK1 on 05-17-2009 10:39 PM
With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
Message 2 of 3
(3,210 Views)

Hi JK1,

 

Thanks for the help. Ya This is what I want for my application. It wrks perfectly:)

0 Kudos
Message 3 of 3
(3,162 Views)