LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Rotate 1D Array continuously

Solved!
Go to solution

Hello 

I am generating Sine Wave and sampling it at 12 samples/ Cycle and storing it in the array. I want to rotate this array continuously one sample at a   time. Suppose my array is [20 10 5 3 1],  I want this array as [1 20 10 5 3] (the last element become the first element)next time I want this array as [3 1 20 10 5 ].

Any Suggestions.

Thanks 

Sugandh

Download All
0 Kudos
Message 1 of 7
(4,131 Views)

You can use the 'Rotate 1D Array' VI in the Array palette.

Smiley Happy

0 Kudos
Message 2 of 7
(4,124 Views)

By Using 'Rotate1D Array' Array rotated one time only. I want to rotate 12 times. Or continuously.

Any suggestions

0 Kudos
Message 3 of 7
(4,117 Views)
Solution
Accepted by Sugandh

image.pngimage.png

Message 4 of 7
(4,110 Views)

Sorry, I didn't check out your VI before suggesting the Rotate 1D vi.

The above code should rotate the array once per loop.

0 Kudos
Message 5 of 7
(4,106 Views)

You can connect the Waveform Graph to the output of the Rotate VI to view the sine wave changing phase. Smiley Wink

0 Kudos
Message 6 of 7
(4,104 Views)
Solution
Accepted by Sugandh

It would be more universal if you would rotate based on the array size. This way you don't need to change constants and cases whenever the requirements change.

(Insert a "Negate" on the blue wire before the "rotate array" node to rotate the other direction)

 

ArrayRotor.png

 

Of course the "simulate" should be before the loop because the output is constant.

Message 7 of 7
(4,060 Views)