Assignment has more non-singleton rhs dimensions than non-singleton subscripts error.
10 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!