Open system in app designer in order to build exe file

조회 수: 10 (최근 30일)
Sabereh
Sabereh 2022년 9월 20일
답변: Abhinav Aravindan 2024년 12월 12일
How can i open simulink model in app designer so that it can be converted into an exe file?
p.s. open_system dosen't work.It causes error while running exe file.

답변 (1개)

Abhinav Aravindan
Abhinav Aravindan 2024년 12월 12일
I assume you want to open a Simulink model using MATLAB App Designer and build the standalone executable file from the opened model. To do so, you may utilize callbacks in App Designer using the following steps:
  1. In the App Designer, use an “Edit Field (Text)” component for entering the Simulink model name.
  2. Use a “Button” component for opening and building the Simulink model.
  3. You may implement a callback similar to the following to open and build the Simulink model.
function OpenandBuildSimulinkModelButtonPushed(app, event)
modelName = app.EditField.Value;
try
% Open the Simulink model
open_system(modelName);
% Build the Simulink model
slbuild(modelName);
% Display a message on successful build
uialert(app.UIFigure, 'Model build successful!', 'Success');
catch ME
% Display an error message if the model cannot be opened or built
uialert(app.UIFigure, ['Error: ' ME.message], 'Build Error');
end
end
Please refer to the below documentation links for more detail:

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by