MATLAB: I have the following code .its showing ” subscript indices must be either real positive integer or logicals”.Plz anyone answer whr is d problem

subscript indices must be either real positive integer or logicals

for n=1:5
A([5-n 5+n],5-n:5+n)=.5*(25+A(6-n,5));
A(6-n:4+n,[5-n 5+n])=.5*(25+A(6-n,5));
end

Best Answer

5-n is 0 when n is 5 in your loop. 0 is not a positive integer.
Related Question