MATLAB: Exporting machine learning model to .NET Assembly

cclassificationmachine learningMATLABMATLAB Compilernet

I have created a .NET assembly using the Matlab Library Compiler and included it in a Visual Studio 2015 C# project. Everything works fine except for when I attempt to make a prediction using the model. The Matlab code looks like this:
load('C:\...\dispositionModel.mat', 'trainedModel1');
result = trainedModel1.predictFcn(data);
I get the following error:
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))
I'm not sure why it's calling functions on the R2018b path, instead of the MATLAB Runtime path. I have included a pragma in my function
%#function fitctree
Looking through other help documentation, I'm only seeing references to C/C++ for using machine learning models with generated code. Is it even possible with C#?

Best Answer

The answer was to call the prediction function differently.
ModelClassificationEnsemble = trainedModel1.ClassificationEnsemble;
result = predict(ModelClassificationEnsemble, data);