MATLAB: Block path relative to masked subsystem

block pathssimulink

Hi there, I'm doing some initialization work in a masked subsystem's initialization callback. I want to set parameters of contained blocks. Currently the only working technique I could come up with is
set_param('model-name/path-to-this-mask-block/child-block', 'param', value );
Is there a way to specify the path relative to the block the mask is for? I tried many combinations including the simple
set_param('child-block', 'param', value );
but nothing I tried would work.

Best Answer

There is a gcb command which stands for "get current block"... so in your case you can use:
set_param([gcb '/child-block'],'param','value');
- Sebastian