Why 'Error Array Indices' happend in this action? And inline also cannot run in the simulator?

5 ビュー (過去 30 日間)
Boanni Raja
Boanni Raja 2022 年 3 月 11 日
編集済み: Walter Roberson 2025 年 3 月 26 日

回答 (1 件)

TARUN
TARUN 2025 年 3 月 26 日
The "Error Array Indices" occurs because MATLAB requires array indices to be positive integers or logical values.
In your code, the variable ai is used as an index, and it may not meet these criteria due to its calculation. Please ensure that ai is consistently a positive integer within the bounds of the array.
Regarding your second question, I would suggest using anonymous functions instead of inline function since inline function is not recommended as mentioned in the documentation.
You can find more information on anonymous functions and inline function in the following documentation:
If the suggested solution does not resolve your issue, please feel free to send me the file you're working with.
  1 件のコメント
Walter Roberson
Walter Roberson 2025 年 3 月 26 日
編集済み: Walter Roberson 2025 年 3 月 26 日
Even before that, there is f2(m,a) and f2(m,b) when a is 0 and b is pi. Those are fine references if f2 is a function handle or a function, but are problems if f2 is a variable. It is difficult to tell because the display of f2 is mostly cut off... what little can be seen is consistent with f2 being inline.
However... we do not know how the inline was declared. Possibly it was declared with fewer than two or more than two input variables...

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

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by