Info

This question is closed. Reopen it to edit or answer.

Classificationlearner model doesn't run on Simulink

1 view (last 30 days)
I wasn't able to load a trained model into Simulink.
I used the Classificationlearner app which only produces a Matlab function.
The function works well in a Matlab script but doesn't compile in a Matlab function block running in Simulink.
The compile starts but then fills GB of memory over a few minutes.
Here is the function code:
function Case_Prediction = RunANN(Predictors)
persistent ANN
Case_Prediction = 0;%Tell Simulink the size of the output
Predictors = [0,0,0,0,0,0,0,0,0,0,0];
if isempty(ANN)
ANN = loadCompactModel('ANN.mat');%Load it only once
end
Case_Prediction = predict(ANN, Predictors);%Perform the prediction
end
In Simulink, the fucntion looks like this:
Captures.PNG
The compact structure looks like this:
Capture.PNG
What is wrong?
Thanks for your help.
Marco

Answers (0)

Community Treasure Hunt

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

Start Hunting!