How can I create a standalone application using my model from Regression Learner?

1 view (last 30 days)
I have created a model using the Regression Learner on Matlab and am using the GPR algorithm, I wanted to create a standalone application to predict load consumption using this model, so used the help button and it said to use this function:
function ypred = mypredict(tbl)
%#function fitrgp
load('mymodel.mat');
ypred = trainedModel.predictFcn(tbl);
end
I used this and it said that I need to specify variables to load from the file, so I changed it to:
function ypred = mypredict(tbl)
%#function fitrgp
trainedModel= load('mymodel.mat');
ypred = trainedModel.predictFcn(tbl);
end
However, now it says that I do not have enough input arguments for the
ypred= trainedModel.predictFcn(tbl)
line.
Does anyone know what I have done wrong?
Thanks!

Answers (1)

Sean de Wolski
Sean de Wolski on 2 May 2021
You need to get the data into the compiled app. Typically with compiling to an executable this would be by passing in a file name and having it read the file into a table and then write the results back to a file. Alternatively, you could put a simple user interface around it with a UI table.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!