Azzera filtri
Azzera filtri

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 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Walter Roberson
Walter Roberson il 11 Set 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.

Più risposte (0)

Categorie

Scopri di più su Propagation and Channel Models in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by