Changing model programmatically: discard changes and exit?

조회 수: 9 (최근 30일)
Danijel Domazet
Danijel Domazet 2020년 5월 18일
답변: Fangjun Jiang 2020년 5월 18일
Hi,
I programmatically change a model in Simulink, run the simulation, and exit.
open_system(...)
add_block(...)
sim(...)
When I run it again, I get an error from add_block() that the block already exists.
So I add
save_system('different_name')
and than I can run the model again with no problem.
However, I would like to exit without saving the modified model.
Is it possible to somehow discard the changes and exit?
  댓글 수: 1
Stijn Haenen
Stijn Haenen 2020년 5월 18일
You can stop/quit via the cmd prompt:
!TASKKILL /F /IM MATLABWindow.exe /T &

댓글을 달려면 로그인하십시오.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2020년 5월 18일
close_system(sys,saveflag)

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by