Filter löschen
Filter löschen

Why do I get an "Unrecognized function" error when I run my MATLAB Compiler deployed standalone application?

14 Ansichten (letzte 30 Tage)
I wrote MATLAB code or created an app in AppDesigner that runs without issues in MATLAB Desktop.
When I compile the app with MATLAB Compiler and deploy it, I get errors such as the following when I run the standalone application:
Unrecognized function or variable 'myFuncName'. Undefined function or variable 'myFuncName'. Reference to unknown function 'function_name' from FEVAL in stand-alone mode.
Why do I get these errors when running the compiled version of my application but not when I run it from MATLAB Desktop?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 31 Aug. 2024
Bearbeitet: MathWorks Support Team am 31 Aug. 2024
When you encounter an "unrecognized function", "undefined function", or "unknown function" error in a compiled MATLAB application, it typically indicates missing dependencies during the compilation process.
Common causes include:
  • Function not on path: Ensure all functions are on the MATLAB path during compilation. Test your app or function before you compile it.
  • P-File Dependencies: Without the M-file source code, dependency analysis cannot detect dependencies for P-files. The tool mentioned in this MATLAB answer can help.
  • String arguments: Functions used in strings passed to 'feval', 'eval', 'evalc', or as ODE solver arguments cannot be located by dependency analysis.
  • Callback Strings: MATLAB Compiler does not look for functions in callback strings. Change the string reference to your function to a function handle.
To include any function dependencies explicitly, you can add %#function pragma statements to your code:
Refer to the "Callback Problems Due to Missing Functions" section on the following page for further details, examples, and workarounds for missing dependencies:

Weitere Antworten (0)

Kategorien

Mehr zu Application Deployment finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by