[Scilab-users] please help, I have just a mental blockade

Samuel Gougeon sgougeon at free.fr
Mon Feb 7 20:17:21 CET 2022


Hello Heinz,

Le 07/02/2022 à 18:35, Heinz Nabielek a écrit :
> Sorry, colleagues  -   please help, I have just a mental blockade.
>
> Given vector EE= [3 5 8]
>
> I want to create a stepwise increasing vector E= [0 0 1 1 2 2 2 3 3 3 3]
>
> And would need a system that works for much larger numbers....
>
> Probably dead easy?


--> v = zeros(1,15);
--> v([3 5 8]) = 1;
--> cumsum(v)
  ans  =
    0.   0.   1.   1.   2.   2.   2.   3.   3.   3.   3.   3. 3.   3.   3.


HTH
Samuel




More information about the users mailing list