[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with an if statement inside a while loop
From: |
Richard Kirk |
Subject: |
Re: Problem with an if statement inside a while loop |
Date: |
Thu, 01 Aug 2013 15:29:35 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121030 Thunderbird/10.0.10 |
Try it without the brackets...
while ii<=length(commandList)+1
if commandList(1,ii-1)=="+"
%angle(i+1)=angle(i)+angleInc
pos(ii,:)=pos(ii-1,:)+[0,0,90]
elseif commandList(1,ii-1)=="-"
pos(ii,:)=pos(ii-1,:)-[0,0,90]
%angle(i+1)=angle(i)-angleInc
elseif commandList(1,ii-1)=="F"
pos(ii,:)=pos(ii-1,:)+1./scalingFactor.^n.*[cos([pos(ii-1,3),sin([pos(ii-1,3),0]
%angle(i+1)=angle(i)
else
pos(ii,:)=pos(ii-1,:)
pos(ii-1,:)+1
endif
ii++
end
Cheers.
Richard Kirk