Simulink Local function debug gives "Undefined function 'myFunc' for input arguments of type 'double'"
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Fangjun Jiang
el 14 de Nov. de 2022
Don't do "F9". Add a break point in the Editor, press the "Step" and other buttons to debug.
2 comentarios
Fangjun Jiang
el 14 de Nov. de 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.
Ver también
Categorías
Más información sobre Simulink Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!