Borrar filtros
Borrar filtros

Index error: must be logical or positive integer.

1 visualización (últimos 30 días)
Muhammad Amir Javed
Muhammad Amir Javed el 21 de Feb. de 2023
Comentada: DGM el 21 de Feb. de 2023
T=10:2:60;
f=-1:length(T)+1;
total=-1;
i=f+total;
et=3.5e-4;
dn1=1e-9:100e-9;
if i==0
r=0;
else
% r=(et+((dn1(i+1)-dn1(i))))./((dn1(i)-(dn1(i-1)))+et); upwind and lower
% wind
r=(et+((dn1(i+1)-dn1(i))))./((dn1(i)-(dn1(i-1)))+et);
end
Array indices must be positive integers or logical values.

Respuesta aceptada

Askic V
Askic V el 21 de Feb. de 2023
T=10:2:60;
f=-1:length(T)+1;
total=-1;
i=f+total;
et=3.5e-4;
dn1=1e-9:100e-9;
size(dn1)
ans = 1×2
1 1
size(i)
ans = 1×2
1 29
if i==0
r=0;
else
% r=(et+((dn1(i+1)-dn1(i))))./((dn1(i)-(dn1(i-1)))+et); upwind and lower
% wind
r=(et+((dn1(i+1)-dn1(i))))./((dn1(i)-(dn1(i-1)))+et);
end
Array indices must be positive integers or logical values.
I hope you can see where the error is.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements 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