how do I read the value of the inputs of a block during runtime?

2 views (last 30 days)
I have a simulink model and I want to read the value of one of the inputs of a subsystem of the main model. I paused during runtime and wrote the following command but it gave error. How do I read the input value?
rto = get_param(gcb, 'Faulty Actuators') gives an error saying : SubSystem block does not have a parameter named 'Faulty Actuators', but the name of the input is Faulty Actuator.

Accepted Answer

ES
ES on 15 Jan 2014
gcb is the current block. So if you need a Value of the Propert 'PropertyName', of the current block, you should do
rto = get_param(gcb, 'PropertyName');
You should have selected the inport block so that gcb points that block. In other words, make that inport as the current block by clicking on it.
If you do not want to click on the block, but know the blocks name, then you can do
rto = get_param(BlockPath, 'PropertyName');
And to know the all the properties of the current block, click on the block(set it as current block), then in command window, type
get(gcbh)
gcbh is the handle of the current block, get(gcbh) will list all the properties and values of the current block.

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!