Borrar filtros
Borrar filtros

Matrix dimensions must agree.

1 visualización (últimos 30 días)
hamed
hamed el 17 de Ag. de 2016
Comentada: hamed el 17 de Ag. de 2016
Hello Dears
I have a 3D matrix like this:
H1([3,4,5,6,7,8],1,6)=1;
So, I defined a variable c like:
c=1000*ones(12,1);
When I use the varıable c, I get the error as follow:
Matrix dimensions must agree.
How should I define the variable c to meet 3D matrix?
Thanks
  2 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 17 de Ag. de 2016
What is the meaning of to meet?
Azzi Abdelmalek
Azzi Abdelmalek el 17 de Ag. de 2016
How did you use c?

Iniciar sesión para comentar.

Respuesta aceptada

Thorsten
Thorsten el 17 de Ag. de 2016
c = 1000*ones(size(H1));
  1 comentario
hamed
hamed el 17 de Ag. de 2016
Thanks for your Answer
I revised my code but I have another problem.
I have this line:
z1=bsxfun(@times,(maxc/r),ones(l,r,h3));
also z2 is created according to z1:
z2=zeros(l,r,h3);
The other variable is Cindex:
*Cindex=(i-1)*path+j;*
When I want to write the bellow code:
z2(Cindex)=maxc-1e-8;
I encounter to this error:
In an assignment A(:) = B, the number of elements in A and B must be the same.
Bests

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Operating on Diagonal Matrices 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