I used Classification learner App with a Fine KNN model that I called 'model_test'.
Now I want to use it in simulink.
So, I used a function block with the inputs of my model and 'model_test' as a parameter :
function y = predic(Fflown,N1n1,N2n1,N3n1,Taun1, model_test)
coder.extrinsic('model_test');
coder.extrinsic('model_test.predictFcn');
T=[Fflown,N1n1,N2n1,N3n1,Taun1];
y=0;
y = model_test.predictFcn(T);
end
But I run the simulink model, I have the error :
'MATLAB class 'function_handle' found at 'model_test.predictFcn' is unsupported.
Parameter 'model_test''
I saw that I may should use save CompactModel to export my Classification learner but when I try it I have another error :
"Undefined function 'toStruct' for input arguments of type 'ClassificationKNN'.
Error in saveCompactModel (line 17)
classificationStruct = toStruct(classificationObj); %#ok<NASGU>""
Best Answer