Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

1 visualización (últimos 30 días)
Here is the arrays i'm using
X=Distancia; % Distancia is 1 x 211 double
Y=Topo; % Topo is 1 x 211 double
lluvia = mms*135900 % lluvia is 211 x 1 double
L = lluvia
Fy=gradient(Y);
FY=sum(Fy)/length(Fy);
Y2=Y;
a=1;
and I want run the follow cycle. Is to calculate Darcy's law for infiltration.
while FY<0
for i=1:length(X)-1
H(i)=Y2(i+1)-Y2(i);
A(i)=H(i)*L;
Fy2(i)=(Y2(i+1)-Y2(i))/(X(i+1)-X(i));
if and(X(i) >= 1, X(i) <= 91) %andosoles
K=1e-4
if and (X(i) > 112, X(i) <= 141) %luvisol
K=1e-10
else
K=1e-8
end
end
Q(i)=A(i).*-K.*Fy2(i);
Y2(i)=Y2(i)-(Q(i)/A(i));
Y2(i+1)=Y2(i+1)+(Q(i)/A(i));
end
Fy3=gradient(Y2)
Y3(:,a)=Y2;
FY=sum(Fy3)/length(Fy3);
a=a+1;
b=floor(a/1000)*1000;
if a==b
plot(X,Y2)
pause(0.02)
end
end
  5 comentarios
Marcos Granados Flores
Marcos Granados Flores el 1 de Jun. de 2020
Thank you but keep saying the same error message
"Unable to perform assignment because the indices on the left side are not compatible with the size of the right side"
KSSV
KSSV el 1 de Jun. de 2020
You have not mentioned the line number.
The code runs without any error in my pc. Forget the ouput.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrix Indexing 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