How to solve the error?
1 次查看(过去 30 天)
显示 更早的评论
for k=1:3:22
for l=1:3:22
for i=1:b:M
for j=1:b:N
Block(l,k)=L0(i:i+b-1,j:j+b-1);
A=zeros(200,200);
A=Block;
n1=double(Block).*Rot;
L1=mod(n1,N);
%K=A1;
% R1=(L1 + double(A1))
% m=mod(R1,N);
%A2=L0(4:6,1:3);
end
end
end
end
I have an image,198x198 matrix. I wanted to get 3x3 matrix,each, from the image and do certain operations. Rot=3x3 matrix R0=200x200 matrix. if i take 3x3 matrix each, from the image, i will get 22 matrices in total. In the program, I want to repeat the process 22 times, so i introduced,k and l terms. But i got an error: Subscripted assignment dimension mismatch.
Error in daru (line 37)
Block(l,k)=L0(i:i+b-1,j:j+b-1);
Can somebody help me with a loop to repeat it 22 times?
回答(1 个)
Jon
2018-4-26
Look closely at your your assignment statement, Block(l,k)=L0(i:i+b-1,j:j+b-1). The left hand side, Block(l,k) is a scalar value. It is just the value of the element in row l, column k, of a matrix called Block. The right hand side is is a matrix with b rows and b columns. You are trying to assign this matrix to a scalar value. The error message is telling you that this does not make sense. You can not assign a matrix to something that should be a scalar value.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!