Borrar filtros
Borrar filtros

Error: Errors occurred during parsing of MATLAB function

20 visualizaciones (últimos 30 días)
Prana
Prana el 20 de Oct. de 2023
Comentada: Prana el 17 de Nov. de 2023
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.

Respuesta aceptada

Drew
Drew el 14 de Nov. de 2023
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.

Más respuestas (0)

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by