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-boun...@lists.scilab.org] De la part de Samuel
Gougeon
Envoyé : jeudi 9 novembre 2017 00:31
À : Users mailing list for Scilab <users@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

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to