06-07-2018 06:53 AM
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
Solved! Go to Solution.
06-07-2018 07:05 AM
You can use the 'Rotate 1D Array' VI in the Array palette.
06-07-2018 07:09 AM
By Using 'Rotate1D Array' Array rotated one time only. I want to rotate 12 times. Or continuously.
Any suggestions
06-07-2018 07:22 AM
06-07-2018 07:26 AM
Sorry, I didn't check out your VI before suggesting the Rotate 1D vi.
The above code should rotate the array once per loop.
06-07-2018 07:31 AM
You can connect the Waveform Graph to the output of the Rotate VI to view the sine wave changing phase.
06-07-2018 12:22 PM
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)
Of course the "simulate" should be before the loop because the output is constant.