setting variable to true or false

88 ビュー (過去 30 日間)
Kelsey Pettrone
Kelsey Pettrone 2020 年 9 月 7 日
I need to set the variable doanimate to true or false. and if its true the plot animates and if its false the plot doesn't. I dont know if i am supposed to have a user input or not but im confused on how to make a variable true or false
please help
  1 件のコメント
Rik
Rik 2020 年 9 月 7 日
doanimate=true;
doanimate=false;
What exactly is your question? We don't know anything about your homework assignment, so you will have to explain the context and the task.

サインインしてコメントする。

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2020 年 9 月 7 日
Hi,
As understood your question, you'd need to write a code something similar to this one:
WHAT_2_do = input('Enter 1 to animate the plot; 0 do nothing ');
if WHAT_2_do ==1
for ii = 1:13
rng(ii)
Data = randi([0, 13], 1,13);
plot(Data, '-o'), hold all
drawnow, pause(0.05)
end
else
for ii = 1:13
rng(ii)
Data = randi([0, 13], 1,13);
plot(Data, 'o'), hold all
end
  2 件のコメント
Rik
Rik 2020 年 9 月 8 日
This is probably a homework question, so I would be reluctant to post complete solutions.
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2020 年 9 月 8 日
I will take a note on this issue from now and on. Thanks Rik.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by