simulink subsystem replacement issue

조회 수: 3 (최근 30일)
wenchao zhang
wenchao zhang 2023년 7월 13일
댓글: wenchao zhang 2023년 7월 13일
when i run the following script, nothing happened with out any error, any one can help, thanks in advance.
open_system('untitled20230208');
open_system('untitled20230713');
replace_block('untitled20230208','untitled20230208/OldSub','untitled20230713/NewSub');
set_param('untitled20230713','SimulationCommand','Update');

채택된 답변

Angelo Yeo
Angelo Yeo 2023년 7월 13일
Unfortunately, single usage of "replace_block" does not allow you to replace a whole subsystem.
The "replace_block" is used to replace the simulink block, not the entire subsystem, so the "replace_block" API alone cannot be used to replace the entire subsystem. To implement exactly the workflow you want, you need to use the "add_block" and "add_line" functions to copy and paste all the contents of the source subsystem and associated port configuration into the target model.
  댓글 수: 1
wenchao zhang
wenchao zhang 2023년 7월 13일
thank you, Angelo,now i know the reason.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by