nukeymusic
2009-06-08 13:20:06 UTC
I'm trying to fill an array with the following script:
clear
for n=1:10
x(n.*(n-1)./2+1:n.*(n-1)./2)=n;
end
this doesn't work however, the strange thing is when I don't use a for
loop but just enter lines one and two incrementing n myself each time
it I get the expected result
any help welcome (please don't shoot at a newbie)
nukeymusic
clear
for n=1:10
x(n.*(n-1)./2+1:n.*(n-1)./2)=n;
end
this doesn't work however, the strange thing is when I don't use a for
loop but just enter lines one and two incrementing n myself each time
it I get the expected result
any help welcome (please don't shoot at a newbie)
nukeymusic