Subscript indices must either be real positive integers or logicals.

3 ビュー (過去 30 日間)
Stevy Kuimi
Stevy Kuimi 2017 年 4 月 10 日
回答済み: Star Strider 2017 年 4 月 10 日
I entered this code in matlab:
for k=0:1:4;
t0=0
t(k+1)=t(k)+2;
q(t(k))=(-1)^k;
end
but i get this error. Subscript indices must either be real positive integers or logicals.
can someone please help me' Thanks

回答 (1 件)

Star Strider
Star Strider 2017 年 4 月 10 日
The problem is that 0 is not a positive integer:
for k=0:1:4
You need to re-define your index variables or subscript references.

カテゴリ

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