How to select the columns of a matrix which are a multiple of 5?
6 views (last 30 days)
I don't know how to solve the following exercise:
M is a 3x5000 matrix. A student wants to select the elements on the third row in all columns which are a multiple of 5.
The student writes the following script.
N = zeros(1,1000)
for i = 1:5000
if rem(i,5) == 0
N(i/5) = M(3,i);
I have to simplify it using only N = M(...). How do I do that?