Error: Errors occurred during parsing of MATLAB function

19 次查看(过去 30 天)
Hi guys,
I have created a prediction model for a variable in a process, based on the inputs and different sensor readings. I used "saveLearnerForCoder" for saving this prediction model. The prediction done using a dataset that contains 8 fields (input) and one response. I have a simulink model of the process. There i am trying to use a matlab function block that receives the inputs from the process. Inside the function block, I need to use "loadLearnerForCoder" for accessing the prediction model and use it for prediction for the inputs received. ( Note: The input data format, number of filds received are the same as that in the prediction model). The matlab function block receives a concatenated matrix that has 8 fields. It is supposed to utilize the prediction model and predict the response. But I am getting the following error.
"You must pass X as a matrix with 8 columns. Function 'MATLAB Function' (#76.455.481), line 15, column 8: "predict(CompactMdl,mydata)" Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
Errors occurred during parsing of MATLAB function 'Integratedbenchmarkk/MATLAB Function'
Component:MATLAB Function | Category:Coder error
Errors occurred during parsing of MATLAB function 'Integratedbenchmarkk/MATLAB Function'
Component:Simulink | Category:Model error
Please help.

采纳的回答

Drew
Drew 2023-11-14
MathWorks provides specific Simulink blocks for ML model prediction. Using one of these Simulink blocks may satisfy your use-case. You can find these blocks at https://www.mathworks.com/help/stats/code-generation.html
Here is an image from that doc page:
If this answer helps you, please remember to accept the answer.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by