How to eliminate, function not found warnings when using Matlab Runtime
17 views (last 30 days)
Show older comments
Sameer Raheja
on 2 Jan 2020
Commented: Sameer Raheja
on 3 Jan 2020
I have built a .net library using Matlab R2018b, which uses a Classification Learner trained model of type SVM (CompactClassificaitonECOC). While using the classification from within Matlab works fine, when I use the .net library, I get all sorts of warnings for it, which say "Could not find appropriate function on path loading function handle..." e.g.
Warning: Could not find appropriate function on path loading function handle C:\Program Files\MATLAB\R2018b\toolbox\stats\mlearnapp\+mlearnapp\+internal\+model\DatasetSpecification.m>@(x)exportableModel.predictFcn(predictorExtractionFcn(x))
Warning: Could not find appropriate function on path loading function handle C:\Program Files\MATLAB\R2018b\toolbox\stats\mlearnapp\+mlearnapp\+internal\+model\+transformation\TrainedManualFeatureSelection.m>@(x)decoratedPredictFunction(featureSelectionFunction(x))
Warning: Could not find appropriate function on path loading function handle C:\Program Files\MATLAB\R2018b\toolbox\stats\mlearnapp\+mlearnapp\+internal\+model\DatasetSpecification.m>@(t)t(:,predictorNames)
> In setupClassification>@(x)exportableModel.predictFcn(predictorExtractionFcn(x))
and so on..
Please help in resolving this. I am using Matlab Runtime 2018b as well.
0 Comments
Accepted Answer
Steven Lord
on 2 Jan 2020
From your description it sounds like you're loading an instance of an object from a MAT-file in your application.
If you're loading an object into your standalone application without giving any indication in the code of the application itself that the definition of the object will need to be included in the application, the dependency analysis may not include it in the application. [See the Tip in the "Fixing Callback Problems: Missing Functions" section on this documentation page, which though it's for the most recent release I believe is still applicable for older releases.]
You're probably going to need to use the %#function pragma or the -a option to include the definition of the class in your application, or you'd need to indicate in the code itself (say by calling the class constructor) something that informs the dependency analysis routine that it needs to include the class definition.
3 Comments
Steven Lord
on 2 Jan 2020
A MAT-file is not a function. You need to tell MATLAB that it needs to include the definition of the class in the application, so when it loads the object from the MAT-file MATLAB knows how to create it.
If you tell me you're bringing a dessert (the object) to a potluck dinner, you should tell me (MATLAB, mcc) that it needs to be kept cold before you bring it (when you compile the application) so I can make sure I have ice packs or a small refrigerator (the class definition) available. If not, at best we end up with ice cream soup. At worst, we have to throw it away lest everyone ends up with food poisoning.
What's the class of model.trainedModel? Use that class name in your pragma. [You may also need to specify the name of the MAT-file in your call to mcc, I'm not certain of that off the top of my head. Regardless it shouldn't hurt.]
More Answers (1)
Image Analyst
on 2 Jan 2020
Some functions cannot be included in a compiled executable. Usually they are applets with a user interface like the Classification Learner, Color Thresholder, Image labeler, etc.. Check the excluded files log file to see what files it cannot include. Call tech support if you still have problems that you think are not related to that.
2 Comments
See Also
Categories
Find more on Deploy to .NET Applications Using MWArray API in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!