if statement - MATLAB resets the values of variables -
i'm new matlab , created program i'm trying similar situation this
pushbutton1 = 1 b = 1 c = 1 if (level==1) newsize=<some calculations here> = newsize elseif (level==2) newsize=<some calculations here> b = newsize else newsize=<some calculations here> c = newsize end plot(a,b,c)
but when 'level' changes, has update 'newsize' on a/b/c . each time click button, previous variables being reset. understand logically correct program reset values, cant figure way "save" values. don't if i'm tired see or more complicated this, appreciate if helped me on that!
thank you!
if want save past values can this:
a = [a newsize];
that way when go through add of values ever increasing list instead of replacing them.
Comments
Post a Comment