Effacer les filtres
Effacer les filtres

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 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Walter Roberson
Walter Roberson le 11 Sep 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.

Plus de réponses (0)

Catégories

En savoir plus sur Propagation and Channel Models dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by