刚接触matlab,代码如下,系统报错:Subscript indices must either be real positive integers or logicals.
大家帮我看看数组下标哪里出问题了?
I=imread('F:\ikonos\1.jpg'); I=rgb2gray(I);
imwrite(I,'F:\ikonos\gray1.jpg');
h=size(I,1); w=size(I,2); h1=ceil(h/2); w1=ceil(w/2);
I1=zeros(h1,w1);
for i=1:h1
for j=1:w1
h1(i,j)=h(2i-1,2j-1);
end
end