MATLAB Answers

0

Why, Array indices must be positive integers or logical values

Penuel Adiyiah さんによって質問されました 2019 年 10 月 13 日
最新アクティビティ Star Strider
さんによって 回答されました 2019 年 10 月 13 日
P=450000 r=0.042 M=P(r/12) Error array indices must be positive or logical values.
Can someone please help me Why is it saying this

  0 件のコメント

サインイン to comment.

タグ

1 件の回答

Star Strider
回答者: Star Strider
2019 年 10 月 13 日

It is saying that because ‘r’ is not an integer, and even if it was, there are only some instances in which ‘r/12’ would be an integer greater than 0.
Aside from that, ‘P’ is a scalar, so any subscript vallue other than 1 would not be valid.
However I suspect you are missing an multiplication operator, so that the assignment should be:
M = P.*(r/12)
since MATLAB does not recognise implicit multiplication.

  0 件のコメント

サインイン to comment.



Translated by