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

3 vues (au cours des 30 derniers jours)
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 commentaires
Marcos Granados Flores
Marcos Granados Flores le 1 Juin 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 le 1 Juin 2020
You have not mentioned the line number.
The code runs without any error in my pc. Forget the ouput.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by