Array indices must be positive integers or logical values.

I have a few function scripts and a main script. The function scripts can run perfectly without errors when I manually input some values. However, when these function scripts are called inside the main script with the exact same input values, an error occured pointing to the function script "Array indices must be positive integers or logical values." Attached below are my function scripts and the main script "test_controller.m".
Can someone give me some hints? The error causes the "test_controller.m" script to break at line 72

3 件のコメント

Benjamin Thompson
Benjamin Thompson 2022 年 3 月 14 日
Your code fails at line 67 due to a problem calling "hat". You have also not posted a function called position_control. Please be sure to post all the code for a good answer, and make sure the code is running OK up to the point where your error is happening.
Benjamin Thompson
Benjamin Thompson 2022 年 3 月 14 日
Have you tried debugging in the editor to catch your problem and fix it yourself? You could add a try/catch statement in EOM to catch exceptions and look at the inputs to EOM causing the exception.
Randy Chen
Randy Chen 2022 年 3 月 14 日
thanks! It seems like I have exceeded the 10-file limit daily upload. I'll try to use the editor

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

回答 (0 件)

カテゴリ

タグ

質問済み:

2022 年 3 月 14 日

コメント済み:

2022 年 3 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by