Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Can someone help me convert this if-else statement to a switch statement? Its a homework problem that requires us to answer whether it would be quicker to write it as a switch or as an if-else statement. Im most confused by the for loop at the top.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
for i = 1:2000
for j = 1:6
if j == 1
result = 20;
elseif j == 2
result = 30;
elseif j == 3
result = 40;
elseif j == 4
result = 50;
elseif j==5
result = 60;
else result = 0;
end
end
end
0 commentaires
Réponses (0)
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!