Get the parent Model like the Menu command "Go To Parent"

Hello guys!
Is it possible to find out (using a script) the parent of a referenced model like Simulink does with "View > Go To Parent"? This command knows what was the last parent in which the user opened the child model.

Answers (1)

This is undocumented, so use with caution because there is a possibility it won't work in all (past/future) releases:
>> get_param('modename', 'ModelReferenceParent')
I would recommend submitting an enhancement request to MathWorks Tech Support to have a published API for this.

3 Comments

I tried using this parameter. Apparently it's only set when you have the parent model open and double-click on the Model Reference block to navigate to the child model. Once the child model is closed this parameter value is reset so the child model "forgets" it was referenced by another model.
My guess is that this parameter was added to enable the "up arrow" in the toolbar of the model window to work for a referenced model.
This was deprecated in R2022b.
What is the recomanded way to do that in R2022b?

Sign in to comment.

Categories

Products

Asked:

on 2 Apr 2013

Community Treasure Hunt

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

Start Hunting!