MATLAB Answers

Find the structure name which created the variable

10 views (last 30 days)
Mangesh Takkar
Mangesh Takkar on 30 Oct 2020
Edited: Ameer Hamza on 30 Oct 2020
hi,
I have one variable which has a structure as an assigned input
Model_output = System_1.SuccessPoints
Model_output =
struct with fields:
Temperature1: [1x1 timeseries]
Temperature2: [1x1 timeseries]
now, as the 'Model_output' has become a structure, how can i extract the name of the structure which created the Model_output after the assignment. Can you please help me?
Input to the code = Model_output
Output = created from 'System_1'
Thank you

  0 Comments

Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 30 Oct 2020
Edited: Ameer Hamza on 30 Oct 2020
Not possible in MATLAB.
A somewhat similar thing can be done by creating a custom handle class and define a parent property, but that is different than creating a struct. Even in that case, you will not get the variable name, just the reference to the original variable itself.

  0 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by