Borrar filtros
Borrar filtros

How to solve the error?

1 visualización (últimos 30 días)
Darsana P M
Darsana P M el 26 de Abr. de 2018
Respondida: Jon el 26 de Abr. de 2018
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?
  3 comentarios
Darsana P M
Darsana P M el 26 de Abr. de 2018
Yes sir,But it is a different code. I have been trying this the whole day. I am trying different codes,but none give me the results. Could somebody help me to solve this.
Darsana P M
Darsana P M el 26 de Abr. de 2018
I am weak in using for loops. Can anyone help me out?

Iniciar sesión para comentar.

Respuestas (1)

Jon
Jon el 26 de Abr. de 2018
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.

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by