A strange problem occurs to me trying to integrate my trained RegressionGP in a Simulink Model using a MATLAB Function block, saveLearnerForCoder and loadLearnerForCoder.
I trained two GPs with the same size of predictors which is 75. I use the same script for training and optimization. The only difference are the measurements used for training. I use sequences of 25 datapoints from three sensors each.
The first GP works flawlessly in a matlab skript ans also in Simulink using a MATLAB Function block. The second GP works without problem in a MATLAB script. When I try to complie the same Simulink model with the second GP (change name of file in loadLearnerForCoder) I get the following error:
The input to coder.const cannot be reduced to a constant: Unsupported value. Function 'loadLearnerForCoder.m' (#76.1874.1895), line 41, column 68: "matFile.compactStruct" Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
Function call failed. Function 'MATLAB Function2' (#55.201.239), line 10, column 7: "loadLearnerForCoder('gprMdl_V106_LUT')" Launch diagnostic report.
This is the function I use in both cases:
function [prediction, upperConf, lowerConf] = gpr_predict_V101(X)
prediction = 0.0;
confidence = [ 0.0 0.0 ];
upperConf = 0.0;
lowerConf = 0.0;
mdl = loadLearnerForCoder('gprMdl_V101_LUT');
[prediction, ~, confidence] = predict(mdl,X);
upperConf = confidence(:,1);
lowerConf = confidence(:,2);
The input data is preprocess the same way for both GPs and therefore has the same size. I checked all dimensions and compared the compacStruct created for both GP through saveLearnerForCoder and couldn't finde any difference besides the GP hyperparameters and ActiveSet used.
Does anyone know where else this error could come from?
Thanks in advance!