Borrar filtros
Borrar filtros

Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-4.

2 visualizaciones (últimos 30 días)
a=[1 1 3;2 0 2;1 1 0;];
b=[5;6;7]
ab=[a b]
%pivot 1,1
%
if ab(1,1)< abs(max(ab(:,1)))
piv=ab(1,:)
ab(1,:)=ab(2,:)
ab(2,:)=piv
ab(2,1)=ab(2,:)-ab(2,1)/ab(1,1)*ab(1,:)
ab(3,1)=ab(3,:)-ab(2,1)/ab(1,1)*ab(1,:)
end

Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Sept. de 2021
ab(2,1)=ab(2,:)-ab(2,1)/ab(1,1)*ab(1,:)
ab(2,1) is a scalar and ab(1,1) is a scalar, so ab(2,1)/ab(1,1) is a scalar. So at the end of the expression, you are multiplying the vector ab(1,:) by a scalar, getting back a vector.
ab(2,:) is a vector.
You are subtracting a vector from a vector, which is an operation that returns a vector.
So the right hand side is a vector.
The destination ab(2,1) is, however, a scalar location. You cannot store a vector into a scalar location.

Más respuestas (0)

Categorías

Más información sobre Propagation and Channel Models 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