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

3 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Rik
Rik el 6 de Nov. de 2017
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);

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by