Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Howto not recursively add_block a subsystem?

Subject: Howto not recursively add_block a subsystem?

From: Oliver

Date: 30 Aug, 2010 09:17:03

Message: 1 of 6

Hi everybody,

I hope you can help me. How can I non recursively copy a subsystem from one model into the other? I only find the option 'CopyOption' 'duplicate'

Thanks in advance,
Oliver

Subject: Howto not recursively add_block a subsystem?

From: Oliver

Date: 30 Aug, 2010 10:08:03

Message: 2 of 6

The thing is, I don't want to copy its children. I could add an empty subsystem directly from the library, but then I would miss all the modified parameters. Another way would be to call the Simulink.SubSystem.deleteContents(subsys) function on the copied subsystem, but I think that's not very efficient.

Please I need your help.

Thanks

Subject: Howto not recursively add_block a subsystem?

From: Thomas Vanaret

Date: 30 Aug, 2010 13:11:20

Message: 3 of 6

Do you think about creating a new subsystem block and then copy parameters you want to keep from original subsystem to the new one?

Subject: Howto not recursively add_block a subsystem?

From: Oliver

Date: 30 Aug, 2010 13:44:07

Message: 4 of 6

Hi,

thank's for your answer....

Actually I did, but I am just worried about missing some parameters (e.g. 'Objectparameters', 'MaskedParameters',...??) and it also looks like I can't set e.g. Objectparameters at one. It always gives me a read-only error

params = get_param(old_block,'Objectparameters');
set_param(new_block,'Objectparameters',params);

??? Error using ==> set_param
--> SubSystem block parameter 'ObjectParameters' is read-only.

I think I stick with the delete contents solution...or do you have any other ideas...?

Subject: Howto not recursively add_block a subsystem?

From: Thomas Vanaret

Date: 30 Aug, 2010 15:25:22

Message: 5 of 6

Some block parameters are "special", this is the case for "Objectparameters" and masked parameters.

"Objectparameters" indicates in fact (quite) all block all parameters with their attribute (RO or RW) and is thus itself a read only parameters. (You can also notice that it contains no values)
You don't need to modify that parameter. You must modify "real" parameters. (like "ForegroundColor", "BackgroundColor", "OpenFcn", ....)

Concerning Mask Parameters, see Matlab help about them. Some of them are useless ("Mask[xxx]String"), since they are just the old version of another one.
I suppose you masked your subsystem (else there is nothing to do), then you should focus on the following parameters : MaskDescription, MaskHelp, MaskDisplay
And the following who define how the mask look like (popup, checkbox,...) :
MaskNames, MaskPrompts, MaskStyles, MaskValues, (MaskCallbacks, MaskEnables if used)

Don't copy MaskWSVariables, which is Read Only

I hope this will be helpful for you

Subject: Howto not recursively add_block a subsystem?

From: Oliver

Date: 31 Aug, 2010 06:07:07

Message: 6 of 6

Thanks for your detailed answer, but I think its easier and less error prone to copy the subsystem and then delete its contents.

Thanks a lot!!
Oliver

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us