MATLAB: How to read the value of the inputs of a block during runtime

blockmodelsimulink

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.

Best Answer

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.