How to save parameters of masked subsystem to workspace

1 view (last 30 days)
Hello, I am a simulink leaner. I have one problem needs your suggestion and help. Thank you. In my simulink model A, there are several masked subsytems (a,b,c.. ), in which the parameters are defined ({x1} for a; {x2} for b;...).
The output port "Out1" of model A denotes my object result, but it should be a iterative result. I have to set a loop run for model A based on intial [{x1}, {x2}, {x3}... ]. The "Out1" should be returned to main arithmetical program, and the main program will assign updated {x1'} for masked system a; {x2'} for masked system b;...
I am using the "sim" in the circumstant, and met all these problems. Thank you. I am not sure which commands are supposed to use. Or there is more suitable command? Thank you.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 5 Aug 2011
By default, signal on output port "Out1" is logged into workspace as "yout". After every iteration of your sim() run, you can check the value of yout in the workspace. The signal for "Out1" should be the first column of yout. Based on the value, you can use set_param() to change the parameter for your masked subsystem and then repeat the simulation.
  5 Comments
Kaustubha Govind
Kaustubha Govind on 5 Aug 2011
What is the error you receive when you say "The second iteration stuck after (5)"?
J T
J T on 17 Aug 2011
Hi Kaustubha, Thank you.
The problem has been solved, the type of output was incorreted.

Sign in to comment.

More Answers (0)

Categories

Find more on Author Block Masks 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!