Classificationlearner model doesn't run on Simulink

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

답변 (0개)

이 질문은 마감되었습니다.

질문:

2019년 5월 26일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by