Clear Filters
Clear Filters

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

7 views (last 30 days)
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?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 31 Aug 2024 at 0:00
Edited: MathWorks Support Team about 11 hours ago
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:

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!