フィルターのクリア

Convert Simulink model into MATLAB algorithm

6 ビュー (過去 30 日間)
Tanusree
Tanusree 2024 年 1 月 31 日
回答済み: T.Nikhil kumar 2024 年 2 月 13 日
How can we get MATLAB code for Simulink model? How to convert the .slx file into .mat file?

回答 (1 件)

T.Nikhil kumar
T.Nikhil kumar 2024 年 2 月 13 日
Hello Tanusree,
According to my knowledge, I do not think it is possible to get MATLAB code for a Simulink Model. Generating executable MATLAB code that replicates the functionality of a Simulink model is not straightforward due to the graphical nature of Simulink and the complex interactions between blocks.
The Simulink Coder can generate C/C++ code from Simulink Models. You can try using Simulink Coder if you want to execute your Simulink Model only via MATLAB. This would still require you to open Simulink and use Simulink coder to generate a ‘.exe’ executable file for the model.
You can then run the ‘.exe’ file using the ‘system’ command in command window. This will start the model and also capture the output data in a ‘.mat’ file . Both these files would be saved to your current folder.
% Sample usage of system command
system("Tracking.exe")
Refer to the following documentation about ‘system’ function:
Hope this helps!

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by