フィルターのクリア

Why do I get "Subscript indices must either be real positive integers or logicals."??

2 ビュー (過去 30 日間)
Iraklis S
Iraklis S 2017 年 1 月 16 日
編集済み: Stephen23 2017 年 1 月 16 日
Hello,
So I have 3 arrays with double variables and I want to merge them into one array, each one of them into a collumn of Wine array. This is my code:
for i=0:178
if i==49
i=60;
end
if i==108
i=131;
end
Wines=[TotalPhelons(i,:);Flavanoids(i,:);NonflavanoidPhenols(i,:)];
end
Why do I get this error? [I want specific variables from each array to import into Wines.]
Thanks in advance!
  2 件のコメント
Adam
Adam 2017 年 1 月 16 日
I would say that error message is pretty self-explanatory surely! It is always useful to actually interpret an error message and understand what it means rather than just look at it as "an error" that you don't know what to do with.
Iraklis S
Iraklis S 2017 年 1 月 16 日
What you said is true and I agree with you. But I was in a situation everyone of us have been, "Why doesn't it work?". I've spent an hour and I completely ignored it, obviously a syntax error, believing it has something to do with array types. Nevertheless, thanks again everyone!

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

採用された回答

Stephen23
Stephen23 2017 年 1 月 16 日
編集済み: Stephen23 2017 年 1 月 16 日
Because of this line:
i=0:178
You start your indices from zero, but MATLAB indices start from one. Read the error message: it tells you what the problem 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