Rewrite the following nested if-else statement as a switch statement that accomplishes exactly the same thing. Assume that num is an integer variable that has been initialized, and that there are functions f1, f2, f3, and f4
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:4| Question number:24.4
All Answers
total answers (1)
Ch4Ex24.m
% To run this, would need to create functions
switch num
case {-2, -1}
f3(num)
case {0, 1, 2}
f2(num)
case {3, 4}
f4(num)
otherwise
f1(num)
end
need an explanation for this answer? contact us directly to get an explanation for this answer