in a function my answer is 'S=-102'. after that further more i cannot take answers , it give error massage saying

1 回表示 (過去 30 日間)
answer ==== S=-102 ''Attempted to access (-102); index must be a positive integer or logical.'' why is this and what is the solution for this.
  1 件のコメント
Geoff Hayes
Geoff Hayes 2016 年 10 月 4 日
shashika - given the error message, it sounds like you are trying to use S (which is negative) as an index into array. Perhaps something like
someArray(S)
As the error message states, the index must be a positive integer or logical. Your S is negative so using this value to access an element in an array does not make sense. You need either to guard against using a negative index or ensure that the code which initializes S only does so with valid positive integers.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by