![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1539747/image.png)
Error: Errors occurred during parsing of MATLAB function
조회 수: 20 (최근 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.
댓글 수: 0
채택된 답변
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1539747/image.png)
If this answer helps you, please remember to accept the answer.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!