How to change the input of a subsystem using open_system
Show older comments
There are two blocks in the model I designed: MATLAB Function and testSub.

At this time, I would like to control the input of testSub using MATLAB Function.
So I designed the code as below.
function y = fcn(u)
coder.extrinsic("set_param");
coder.extrinsic("close_system");
coder.extrinsic("open_system");
set_param('untitled1/Subsystem/testSub','OpenFcn','');
open_system('untitled1/Subsystem/testSub','OpenFcn');
y=1;
I want to set input to 'u' in set_param, but is there any way?
help will be appreciated.
Thanx
2 Comments
Angelo Yeo
on 22 Dec 2023
Can you describe the desired workflow? What do you want to do in the end?
eblee
on 25 Dec 2023
Accepted Answer
More Answers (0)
Categories
Find more on Using MATLAB Projects in Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!