How to load a trained classifier model inside Simulink MATLAB function in MATLAB 2015a?
Show older comments
Hi,
I have trained a classifier for my dataset in MATLB 2022a and saved it as a mat file (classifiername.mat). I need to load this classifier model inside Simulink Matlab function (MATLAb 2015a) and then use predict() to do prediction for my new data set. When I use these commanda in command window or m.file (not inside Simulink) of MATLAB 2015a
load classifiername.mat
[label] = predict(classifiername,XTest);
It load the classider as an object and everything works well, But I need to do all of these steps in Simulink which doesn't work.

function label = svmIonospherePredict(XTest)
load classifiername.mat ;
[label] = predict(classifiername,XTest);
end
This is the error:
The output of a call to 'load' is not assigned to a variable. Assign its output to a variable without subscripting.
Function 'MATLAB Function' (#35.570.591), line 11, column 1:
"load('classifiername.mat')"
Launch diagnostic report.
when I load the classifier to a variable, it change its format to structure and then I cannot use the model inside the predict () function.
I would be thankful for any help.
Accepted Answer
More Answers (0)
Categories
Find more on Classification Ensembles 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!
