please suggest me how to solve this problem

1 visualización (últimos 30 días)
ANUJA THAKUR
ANUJA THAKUR el 12 de Mayo de 2021
Comentada: Walter Roberson el 12 de Mayo de 2021
Unable to perform assignment because the size of the left side is 1-by-273 and the size of the right side is 1-by-273-by-2.
  1 comentario
Walter Roberson
Walter Roberson el 12 de Mayo de 2021
It would help to see the line of code, and to know the size() of all of the variables mentioned on the line.

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 12 de Mayo de 2021
The error is clear and simple. You are trying to save more number of elements then initialized into the matrix.
A = zeros(2,3) ; % initialize A as 2*3 matrix
% save elements
A(:,1) = rand(2,1) ; % no error
A(:,2) = rand(2,1) ; % no error
A(:,3) = rand(3,1) ; % error, as LHS is expecting array 2*1 but RHS is 3*1
Similiarly, in your case you have initialized matrix as size 1*273, but you are trying to save a matrix 1*273*2. You need to change your initialized LHS matrix accordingly.

Más respuestas (0)

Categorías

Más información sobre Logical 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