필터 지우기
필터 지우기

Hello everyone How do i include my simulink block model in my livescript.someone please help. thanks in advance

조회 수: 74 (최근 30일)
i have created my simulink block diagram, now i want to insert it to my live editor. How do include my simulink model from live editor, i want to run it there

답변 (1개)

Saurabh
Saurabh 2023년 6월 16일
To include a Simulink model in a MATLAB Live Script, you can use the simulink function and specify the name of the model file. Here are the steps to do it:
  1. In your MATLAB Live Script, define the name of your Simulink model and set it as a string variable.
modelName = 'mySimulinkModel'; % replace 'mySimulinkModel' with the name of your model file
  1. Insert a new code block in your Live Script where you want to include the Simulink model. In the code block, use the simulink function along with the open argument to open the model in Simulink.
% Open the Simulink model
simulink(open(modelName));
  1. You can now run the previously defined Simulink model in the MATLAB Live Script by simulating it from the script itself using sim command.
% Simulate the model
sim(modelName);
Note that when you run the sim command, the simulation results will be stored in the MATLAB workspace. You can then use MATLAB Live Editor commands like plot or display to visualize the simulation results.
Also, make sure that the Simulink model file is saved in the current or active folder of your MATLAB Live Script.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by