Calling machine learning model on matlab simulink

11 ビュー (過去 30 日間)
Meriem zanoun
Meriem zanoun 2023 年 11 月 30 日
回答済み: Gayathri 2024 年 9 月 24 日
Hello everyone, I'm using Simulink for running simulations, and I'd like to call a trained machine learning model (in my case, a TreeBagger) in MATLAB to make predictions in Simulink. However, I'm having some trouble with it. Has anyone already worked with this?
  2 件のコメント
Tien
Tien 2023 年 11 月 30 日
Not sure what was your specific issue, but you can have a look at the example of how to use a pretrained model to perform classification in Simulink:
Meriem zanoun
Meriem zanoun 2023 年 12 月 6 日
Thank you for your response. Unfortunately, I'm dealing with a different issue here.

サインインしてコメントする。

回答 (1 件)

Gayathri
Gayathri 2024 年 9 月 24 日
I understand that you want to use a trained machine learning model from MATLAB to make predictions in Simulink. Let us assume that the trained model is named “net” in MATLAB. In that case, save the trained model to a “.mat” file for using it in Simulink using the following command.
save('trainedModel.mat', 'net');
Next, open the Simulink model and add a “Predict” block. Open the “Block Parameters” of the “Predict” block and select “Network from MAT file” in the “Network” section. Also browse the “trainedModel.mat” path in “File path”.
Please find a screenshot of the “Block Parameters” dialog box below.
For more information on “Predict” block please refer to the below link.
Also, in addition to this method, in MATLAB R2024b version there is a new function “exportNetworkToSimulink”, that helps create a Simulink model containing deep learning layer blocks corresponding to deep learning layer objects. It can be executed using the following command.
exportNetworkToSimulink(net,ModelName="myExportedModel")
For more information about “exportNetworkToSimulink”, please refer to the below link.
Hope you find this information helpful.

カテゴリ

Help Center および File ExchangeClassification Ensembles についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by