From: John Reilly on
Hi,

I am using R2007b.

I have a masked subsystem ('NonLinModel/NonLin') that contains a block ('NonLinModel/NonLin/AdaptiveParam') that I'd like to duplicate within the initialization callback script. When I execute the add_block() function as per the documentation,

add_block('NonLinModel/NonLin/AdaptiveParam', ...
'NonLinModel/NonLin/AdaptiveParam2');

I fail with an exception

MException object with properties:

identifier: 'Simulink:SL_AddBlockInvSrcBlock'
message: 'Invalid source block specification.'
stack: [2x1 struct]
cause: {}

Why? add_block() seems to indicate that I can do this.

Thanks.

-john.
From: Phil Goddard on
You seem to be doing the right thing.

There was a time when for a mask to modify the underlying block you needed to set the masked subsystem's MaskSelfModifiable property, i.e.
>> set_param('NonLinModel/NonLin','MaskSelfModifiable','on');

But in more recent releases that's only required if the masked subsytem is part of a library.
I don't remember when that change came about, but you might try it and see if it works for you in R2007b.

Phil.
From: John Reilly on
Hi Phil,

Thanks for the tip, even though it doesn't have any effect. Setting that property gives me the Invalid source block exception. But I can get the property and it is 'on'.

I searched the newsgroup and found a similar question. Someone suggested writing an s-function to encapsulate the variability, so I've done that. Unsatisfying not to have an answer, but I can live with it.

I can put my components into a library and it will work. That just means my library contains a "do not use this" component block.

Thanks again for your help.

-John.


"Phil Goddard" <philNOSPAM(a)goddardconsulting.ca> wrote in message <hnorkt$6ng$1(a)fred.mathworks.com>...
> You seem to be doing the right thing.
>
> There was a time when for a mask to modify the underlying block you needed to set the masked subsystem's MaskSelfModifiable property, i.e.
> >> set_param('NonLinModel/NonLin','MaskSelfModifiable','on');
>
> But in more recent releases that's only required if the masked subsytem is part of a library.
> I don't remember when that change came about, but you might try it and see if it works for you in R2007b.
>
> Phil.