作业帮 > 综合 > 作业

MATLAB提示Error using reshape To RESHAPE the number of element

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/05/20 07:38:39
MATLAB提示Error using reshape To RESHAPE the number of elements must not change.求大神看错在哪了
clear I;
clear G;
G=imread('I:\\2.jpg');
I=rgb2gray(G);
I=double(I);
a=ones(1,24);
n=2;
L=2;
d=de2bi(a);
[H,W]=size(I);
A=[H,W];
i=0;
A
B=reshape(A,(H*W)/n,n);
for i=1:H*W/n
for j=1:n
K(j,1)=B(i,1)*j;
end
y=mod(sum(K),(2*n+1));
r=mod((d-y),2*n+1);
if d==y
B=B;
else if =y&&rn
B(i,r)=B(i,2*n-r)-1;
end
end
end
end
很明显的错误,A=[H,W];A的型号是多少?1*2
B=reshape(A,(H*W)/n,n)改后(H*W)/n*n=H*W
除非H*W=2不然必定错啊
I的型号才是H*W
B=reshape(I,(H*W)/n,n)且(H*W)/n是整数就不会出错~
再问: 改了以后着有提示Subscript indices must either be real positive integers or logicals。我没从0开始调试啊
再问: 之后提示Subscript indices must either be real positive integers or logicals,没有从0开始啊
再答: 你这是哪个语句错误呢
再问: 能加我Q详谈么:876850173