MATLAB: How to eliminate, function not found warnings when using Matlab Runtime

classification learnerMATLAB Compilermcr_r2018bnet assemblypredictorextractorfcnStatistics and Machine Learning Toolbox

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.

Best Answer

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.