Error: Errors occurred during parsing of MATLAB function

조회 수: 13 (최근 30일)
Prana
Prana 2023년 10월 20일
댓글: Prana 2023년 11월 17일
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에서 Signal Operations에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by