annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

Rotate 1D Array continuously

Résolu !
Accéder à la 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

Tout télécharger
0 Compliments
Message 1 sur 7
5 409 Visites

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

Smiley heureux

0 Compliments
Message 2 sur 7
5 402 Visites

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

Any suggestions

0 Compliments
Message 3 sur 7
5 395 Visites
Solution
Accepté par l'auteur du sujet Sugandh

image.pngimage.png

Message 4 sur 7
5 388 Visites

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 Compliments
Message 5 sur 7
5 384 Visites

You can connect the Waveform Graph to the output of the Rotate VI to view the sine wave changing phase. Smiley clignant de l'œil

0 Compliments
Message 6 sur 7
5 382 Visites
Solution
Accepté par l'auteur du sujet 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 sur 7
5 338 Visites