Info
This question is closed. Reopen it to edit or answer.
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 view (last 30 days)
Show older comments
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 Comments
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!