フィルターのクリア

Index error: must be logical or positive integer.

1 回表示 (過去 30 日間)
Muhammad Amir Javed
Muhammad Amir Javed 2023 年 2 月 21 日
コメント済み: DGM 2023 年 2 月 21 日
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.
  1 件のコメント
DGM
DGM 2023 年 2 月 21 日
Is i a positive integer or logical value?

サインインしてコメントする。

採用された回答

Askic V
Askic V 2023 年 2 月 21 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by