Simulink Local function debug gives "Undefined function 'myFunc' for input arguments of type 'double'"
3 ビュー (過去 30 日間)
古いコメントを表示
Hi Everyone,
During the debug process of my Simulink model I encountered an "Undefined function 'myFunc' for input arguments of type 'double'" type error. I created a simple demo model to show you the error. Basically, in Simulink I created a Matlab Function 'sumCode', and a local function within it which is 'crossCode'. When I debugged my code, I inserted a debug point and tried to evaluate that line with F9 and Matlab gives me
"Undefined function 'crossCode' for input arguments of type 'double'." type error. I share the screenshots below.


I tried a similar scenario with the Matlab script, I could run and evaluate the selection with F9 in debug successfully. Do you have any suggestions to handle this problem in Simulink?
Thank you very much for your time.
0 件のコメント
回答 (1 件)
Fangjun Jiang
2022 年 11 月 14 日
Don't do "F9". Add a break point in the Editor, press the "Step" and other buttons to debug.
2 件のコメント
Fangjun Jiang
2022 年 11 月 14 日
What "F9" does is to copy the string and evaluate it in MATLAB Command Window. In your case, execute "c = a+b+crossCode(a,b)". The "debug>>" prompt indicates it is in the function workspace, but the file visibility is still with MATLAB. In other word, in MATLAB Command Window, it does not see function "crossCode()" because it is a "local" function, just the same as it won't be able to call any local functions inside any .m file.
参考
カテゴリ
Help Center および File Exchange で Simulink Environment Customization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!