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

답변 (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

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...

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Function Creation에 대해 자세히 알아보기

제품

릴리스

R2018a

태그

질문:

2022년 3월 11일

편집:

2025년 3월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by