Why 'Error Array Indices' happend in this action? And inline also cannot run in the simulator?
5 次查看(过去 30 天)
显示 更早的评论
回答(1 个)
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
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 Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
