matlab 报错 Error using horzcat CAT arguments dimensions are not consistent.急急急。。。
代码:functionex1()x1=imread('000.bmp');x2=imread('001.bmp');x3=imread('002.bmp');x4=imr...
代码:function ex1()
x1=imread('000.bmp');x2=imread('001.bmp');x3=imread('002.bmp');x4=imread('003.bmp');x5=imread('004.bmp');
x6=imread('005.bmp');x7=imread('006.bmp');x8=imread('007.bmp');k=imread('008.bmp');x9=imread('009.bmp');
x10=imread('010.bmp');x11=imread('011.bmp');x12=imread('012.bmp'); x13=imread('013.bmp');x14=imread('014.bmp');
x15=imread('015.bmp');x16=imread('016.bmp');x17=imread('017.bmp');x18=imread('018.bmp');
a1=x1(:,1);a2=x1(:,72); b1=x2(:,1);b2=x2(:,72);c1=x3(:,1);c2=x3(:,72);d1=x4(:,1);d2=x4(:,72);e1=x5(:,1);e2=x5(:,72);
f1=x6(:,1);f2=x6(:,72);g1=x7(:,1);g2=x7(:,72);h1=x8(:,1);h2=x8(:,72);l1=x9(:,1);l2=x9(:,72);m1=x10(:,1);
m2=x10(:,72);n1=x11(:,1);n2=x11(:,72);i1=x12(:,1);i2=x12(:,72);j1=x13(:,1);j2=x13(:,72);u1=x14(:,1);u2=x14(:,72);v1=x15(:,1);v2=x15(:,72);
w1=x16(:,1);w2=x16(:,72);z1=x17(:,1);z2=x17(:,72);y1=x18(:,1);y2=x18(:,72);
k2=k(:,72);
X=[x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18];
C=[a1 b1 c1 d1 e1 f1 g1 h1 l1 m1 n1 i1 j1 u1 v1 w1 z1 y1];D=[a2 b2 c2 d2 e2 f2 g2 h2 l2 m2 n2 i2 j2 u2 v2 w2 z2 y2];
p=1;
for r=1:18
min=sum(abs(k2-C(r)));
for t1=r+1:19
if sum(abs(k2-C(t1)))<min
min=sum(abs(k2-C(t1)));
end
end
for t2=1:18
if min==sum(abs(k2-C(t2)))
A=C(r);C(r)=C(t2);C(t2)=A;p=p+1;break;
end
end
k2=D(t2);
end
B=k;
for tt=1:18
for j=1:18
if X(j,:,1)==C(tt)
Q=[B,X(j)];
end
end
B=Q;
end
imshow(Q);
end 展开
x1=imread('000.bmp');x2=imread('001.bmp');x3=imread('002.bmp');x4=imread('003.bmp');x5=imread('004.bmp');
x6=imread('005.bmp');x7=imread('006.bmp');x8=imread('007.bmp');k=imread('008.bmp');x9=imread('009.bmp');
x10=imread('010.bmp');x11=imread('011.bmp');x12=imread('012.bmp'); x13=imread('013.bmp');x14=imread('014.bmp');
x15=imread('015.bmp');x16=imread('016.bmp');x17=imread('017.bmp');x18=imread('018.bmp');
a1=x1(:,1);a2=x1(:,72); b1=x2(:,1);b2=x2(:,72);c1=x3(:,1);c2=x3(:,72);d1=x4(:,1);d2=x4(:,72);e1=x5(:,1);e2=x5(:,72);
f1=x6(:,1);f2=x6(:,72);g1=x7(:,1);g2=x7(:,72);h1=x8(:,1);h2=x8(:,72);l1=x9(:,1);l2=x9(:,72);m1=x10(:,1);
m2=x10(:,72);n1=x11(:,1);n2=x11(:,72);i1=x12(:,1);i2=x12(:,72);j1=x13(:,1);j2=x13(:,72);u1=x14(:,1);u2=x14(:,72);v1=x15(:,1);v2=x15(:,72);
w1=x16(:,1);w2=x16(:,72);z1=x17(:,1);z2=x17(:,72);y1=x18(:,1);y2=x18(:,72);
k2=k(:,72);
X=[x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18];
C=[a1 b1 c1 d1 e1 f1 g1 h1 l1 m1 n1 i1 j1 u1 v1 w1 z1 y1];D=[a2 b2 c2 d2 e2 f2 g2 h2 l2 m2 n2 i2 j2 u2 v2 w2 z2 y2];
p=1;
for r=1:18
min=sum(abs(k2-C(r)));
for t1=r+1:19
if sum(abs(k2-C(t1)))<min
min=sum(abs(k2-C(t1)));
end
end
for t2=1:18
if min==sum(abs(k2-C(t2)))
A=C(r);C(r)=C(t2);C(t2)=A;p=p+1;break;
end
end
k2=D(t2);
end
B=k;
for tt=1:18
for j=1:18
if X(j,:,1)==C(tt)
Q=[B,X(j)];
end
end
B=Q;
end
imshow(Q);
end 展开
若以下回答无法解决问题,邀请你更新回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询