Application Compiler not Including Toolbox Functions

I have a uifigure-based application that works fine when run from Matlab itself. I'm now trying to compile and run it as a standalone version. However, I consistently observe errors that indicate a lack of toolbox support. For example, I am getting the error
Undefined function 'prctile' for input arguments of type 'double'
which corresponds to a missing Statistics toolbox. However, my local environment has the statistics toolbox!
The compiler will not let me add the statistics toolbox as a forced include; I can manually copy the toolboxes to my working directory, but that creates a lot of duplicate code and is frustrating to manage in git. How do I force matlab to include the correct code?

Risposte (1)

Without seeing how you're trying to call prctile in your app it's going to be difficult or impossible to give a definitive answer, but if you're calling it in a callback function how is that callback specified? See the section "Fixing Callback Problems: Missing Functions" on this documentation page for a potential cause of this behavior and how to correct it.

2 Commenti

Steven, thanks for the tip.
I have a timer inside the uifigure; the timer's TimerFcn is a function handle. That function calls prctile in this way:
X(X < prctile(X(:)
The call is not in the callback itself, so this shouldn't be an issue.
Moreover, I have been able to temporarily fix the issue by copying the necessary toolboxes to a non-Matlab folder and updating PATH to search those folders first. The dependency analyzer then automatically finds and packages them just fine.
What happens if you use the %#function pragma to tell MATLAB Compiler that it should include the prctile function in the application?
%#function prctile

Accedi per commentare.

Categorie

Richiesto:

il 13 Ott 2022

Commentato:

il 13 Ott 2022

Community Treasure Hunt

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

Start Hunting!

Translated by