[Scilab-users] Shift indices
perrichon
perrichon.pierre at wanadoo.fr
Wed Feb 14 12:36:10 CET 2018
Dear,
this instruction is exactly the one I wanted
It allows me on a PELTON 6 jet machine to get a rotating pilot injector
Pierre.
De : users [mailto:users-bounces at lists.scilab.org] De la part de Samuel
Gougeon
Envoyé : jeudi 9 novembre 2017 00:31
À : Users mailing list for Scilab <users at lists.scilab.org>
Objet : Re: [Scilab-users] Shift indices
Le 08/11/2017 à 15:07, Richard llom a écrit :
Hello,
is there a function available to shift indices?
E.g. I have
aa = [1:10]
and want
bb = 6. 7. 8. 9. 10. 1. 2. 3. 4. 5.
If you need to shift i = 1:n indices by any p -- not necessarily n/2 --, you
may do
si = modulo(i+p-1, n)+1 // with n = length(i);
Example:
i = 1:10, p = 2;
si = modulo(i+p-1, length(i))+1
--> i = 1:10, p = 2;
i =
1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
--> si = modulo(i+p-1, length(i))+1
si =
3. 4. 5. 6. 7. 8. 9. 10. 1. 2.
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180214/250e7a4c/attachment.htm>
More information about the users
mailing list