[Scilab-users] please help, I have just a mental blockade
Heinz Nabielek
heinznabielek at me.com
Mon Feb 7 20:15:52 CET 2022
> On 07.02.2022, at 18:35, Heinz Nabielek <heinznabielek at me.com> wrote:
> 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....
Sorry to bother you, it was dead easy:
n=12; EE=[3 5 8]; E=zeros(1:n);
for j=1:3;
for k=EE(j):n;E(k)=E(k)+1; end;
end;
E = 0. 0. 1. 1. 2. 2. 2. 3. 3. 3. 3. 3.
I do not know why it did not work on my first attempt........
And: perhaps not the most elegant with a doubly nested do-loop.
Heinz
More information about the users
mailing list