<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"Préformaté HTML Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
span.PrformatHTMLCar
        {mso-style-name:"Préformaté HTML Car";
        mso-style-priority:99;
        mso-style-link:"Préformaté HTML";
        font-family:Consolas;
        color:black;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=FR link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='color:windowtext'>Dear,<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN>this instruction is exactly the one I wanted<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN>It allows me on a PELTON 6 jet machine to get a rotating pilot injector</span><span style='color:windowtext;mso-fareast-language:EN-US'><o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext;mso-fareast-language:EN-US'>Pierre.<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='color:windowtext'>De :</span></b><span style='color:windowtext'> users [mailto:users-bounces@lists.scilab.org] <b>De la part de</b> Samuel Gougeon<br><b>Envoyé :</b> jeudi 9 novembre 2017 00:31<br><b>À :</b> Users mailing list for Scilab <users@lists.scilab.org><br><b>Objet :</b> Re: [Scilab-users] Shift indices<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Le 08/11/2017 à 15:07, Richard llom a écrit :<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>Hello,<o:p></o:p></pre><pre>is there a function available to shift indices?<o:p></o:p></pre><pre>E.g. I have<o:p></o:p></pre><pre>aa = [1:10]<o:p></o:p></pre><pre>and want<o:p></o:p></pre><pre>bb =  6.   7.   8.   9.   10.   1.   2.   3.   4.   5.<o:p></o:p></pre></blockquote><p class=MsoNormal style='margin-bottom:12.0pt'><br>If you need to shift i = 1:n indices by <i>any</i> p -- not necessarily n/2 --, you may do<br><span style='font-size:10.0pt;font-family:"Courier New"'><br><tt>si = modulo(i+p-1, n)+1    // with n = length(i);</tt><br></span><br>Example:<br>i = 1:10, p = 2;<br>si = modulo(i+p-1, length(i))+1<br><tt><span style='font-size:10.0pt'>--> i = 1:10, p = 2;</span></tt><span style='font-size:10.0pt;font-family:"Courier New"'><br><tt> i  = </tt><br><tt>   1.   2.   3.   4.   5.   6.   7.   8.   9.   10.</tt><br><br><tt>--> si = modulo(i+p-1, length(i))+1</tt><br><tt> si  = </tt><br><tt>   3.   4.   5.   6.   7.   8.   9.   10.   1.   2.</tt><br></span><br>Samuel<o:p></o:p></p></div></body></html>