I need your help to solve the problem of subscript index that must either be positive integer or logical. Can any one help to correct this ?
A = magic(5); M1 = size(A,1); M2 = size(A,2); E = [5 8 20]; for x = 1:M1 for y = 1:M2 if A(A(x,y) == E) A(x-1,y) = 5 end end end
Thank you!
Best Answer