Q:

The following code was written by somebody who does not know how to use MATLAB efficiently. Rewrite this as a single statement that will accomplish exactly the same thing for a matrix variable mat (e.g., vectorize this code):

0

The following code was written by somebody who does not know how to use MATLAB efficiently. Rewrite this as a single statement that will accomplish exactly the same thing for a matrix variable mat (e.g., vectorize this code): 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

[r c] = size(mat);

for i = 1:r

 for j = 1:c

 mat(i,j) = mat(i,j) * 2;

 end

end

>> mat = mat * 2

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now