Question: MATLAB conditional operation on matrix element with nested for loop You are given a 3 by 4 matrix m of integers use nested for loops
MATLAB


conditional operation on matrix element with nested for loop You are given a 3 by 4 matrix m of integers use nested for loops and if-else statements as necessary, to operate on each element of the matrix m if the element is less than 5, add 0.1 to it if the element is more than 5, subtract 0.2 from it if the element is exactly 5, do nothing display the modified m in the end Script @ Save C Reset MATLAB Documentation 1 m=[7 4 7 0; 8 7 0 1; 8 1 3 9]; 2 for i= 3 for j= 4 if 5 8 -0.2; 9 else 10 % dummy statement, add nothing here 11 end 12 end 13 end 14 end 15 m
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
