フィルターのクリア

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 ビュー (過去 30 日間)
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

採用された回答

Walter Roberson
Walter Roberson 2021 年 9 月 11 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePropagation and Channel Models についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by