Info
此问题已关闭。 请重新打开它进行编辑或回答。
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 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!