フィルターのクリア

Error: Assignment has more non-singleton rhs dimensions than non-singleton subscripts

1 回表示 (過去 30 日間)
Tijjani Aminu Kuda
Tijjani Aminu Kuda 2016 年 3 月 14 日
回答済み: Walter Roberson 2016 年 3 月 14 日
Please can someone help. Im trying to run this code
Hw = zeros(ntrain,ntrain);
for i = 1:ntrain
for j = 1:ntrain
Hw(i,j) = Ytrain(i)*Ytrain(j)*lin(Xtrain(i,:),Xtrain(j,:));
end
end
the size of ntrain = 20
but instead the above error message being displayed.
thanks.

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 3 月 14 日
If lin(Xtrain(i,:),Xtrain(j,:)) is returning a vector or array, then the right hand side of the assignment would result in a vector or array, and you would then not be able to store all of that in the single numeric location Hw(i,j) that you have specified.
My guess is that lin() is probably returning a 2 x 2 array, not a scalar.

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by