Simulink Local function debug gives "Undefined function 'myFunc' for input arguments of type 'double'"
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Fangjun Jiang
il 14 Nov 2022
Don't do "F9". Add a break point in the Editor, press the "Step" and other buttons to debug.
2 Commenti
Fangjun Jiang
il 14 Nov 2022
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.
Vedere anche
Categorie
Scopri di più su Simulink Functions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!