Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

While loop to convert values

1 visualizzazione (ultimi 30 giorni)
mcm
mcm il 24 Ott 2016
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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?

Risposte (1)

KSSV
KSSV il 24 Ott 2016
Modificato: KSSV il 24 Ott 2016
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)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by