A simple problem in creating animation

1 回表示 (過去 30 日間)
yuval baruch
yuval baruch 2014 年 12 月 8 日
回答済み: matt dash 2014 年 12 月 8 日
This program should widen the rectangle 'spring'
maxStep=70;
speed=0.05;
[posArray5]=get(handles.spring,'position');
for i=1:1:maxStep
posArray5(1)=posArray5(1)+1;
pause(speed);
set(handles.spring,'position',posArray5)
end
And I wonder what is the problem because it doesnt work Help will be much apprecieted.

回答 (1 件)

matt dash
matt dash 2014 年 12 月 8 日
Don't just say "it doesnt work", say WHAT isnt working. The code you posted should draw a rectangle that moves across the screen, not one that widens. Is that the problem? If so, you want to be setting posArray5(3), which is the width, not posArray5(1), which is the horizontal offset.

カテゴリ

Help Center および File ExchangeBiological and Health Sciences についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by