Assignment has more non-singleton rhs dimensions than non-singleton subscripts error.

3 ビュー (過去 30 日間)
Divya Priya
Divya Priya 2017 年 11 月 6 日
回答済み: Rik 2017 年 11 月 6 日
for i=1:10201
SemivariancePredicSample_ST(i,:)=(GlobalSill-(T_x(1).*(1-exp(-(DistPredicSample_T.^2)/(T_x(2).^2)))+S_x(1).*(1.5*(DistPredicSample_S(i,:)/S_x(2))-0.5*(DistPredicSample_S(i,:).^3/S_x(2).^3)) ...
-((T_x(1)+S_x(1)-GlobalSill)/(T_x(1)*S_x(1)))*(T_x(1).*(1-exp(-(DistPredicSample_T.^2)/(T_x(2).^2)))).*(S_x(1).*(1.5*(DistPredicSample_S(i,:)/S_x(2))-0.5*(DistPredicSample_S(i,:).^3/S_x(2).^3)))))';
end
I get the error Assignment has more non-singleton rhs dimensions than non-singleton subscripts.
What to do?

採用された回答

Rik
Rik 2017 年 11 月 6 日
Check for typos. This error occurs when the size of the left hand doesn't match the size on the right hand. (there are more dimensions that are not 1 (non-singleton) right hand side (rhs) than there are in the part of the array (the subscript) where you are trying to save it in)
The code below will trigger such an error, and here it is easy to see what is happening:
a=rand(4,4);
a(:,1)=rand(4,1,4);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by