Why 'Error Array Indices' happend in this action? And inline also cannot run in the simulator?
5 views (last 30 days)
Show older comments

0 Comments
Answers (1)
TARUN
on 26 Mar 2025
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 Comment
Walter Roberson
on 26 Mar 2025
Edited: Walter Roberson
on 26 Mar 2025
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...
See Also
Categories
Find more on Function Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!