Info

此问题已关闭。 请重新打开它进行编辑或回答。

While loop to convert values

1 次查看(过去 30 天)
mcm
mcm 2016-10-24
关闭: MATLAB Answer Bot 2021-8-20
I need a while loop that will take a score and set it to 0 if it less or equal than 200
score = input('What was the UPDRS score (0 to 300): ')
while score <= 200
score = 0;
end
disp(score)
My while loop is not working, how can I improve it?

回答(1 个)

KSSV
KSSV 2016-10-24
编辑:KSSV 2016-10-24
Why you will use while here? While is to run a loop/ iterations for a certain condition. For your case, you have to use if.
score = input('What was the UPDRS score (0 to 300): ')
if score <= 200
score = 0;
end
disp(score)

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by