MATLAB: Attempted to access x(1,2); index out of bounds because size(x)=[105760,1].

index out of box

can you please solve this sir
for i=1:2
for j=2:len-1
x(j,i) = (x(j-1,i) + x(j,i) + x(j+1,i))/3 ;
end
end
i am getting error command Attempted to access x(1,2); index out of bounds because size(x)=[105760,1].
Error in highfrequencynoiseremoval (line 14)
x(j,i) = (x(j-1,i) + x(j,i) + x(j+1,i))/3 ;

Best Answer

From the error message, it appears that your variable x is a a column vector 105760x1 . In your code you are trying to access x(1,2) which should be in the second column that doesn't exist
Related Question