Error: Errors occurred during parsing of MATLAB function

10 ビュー (過去 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 件)

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by