??How to get the Name of the Output to the left of the equal sign??
Show older comments
Hallo everyone,
I am now searching a way to get the Name of the output to the left of the equal sign in a function.
For example, I call a function like this:
OutputName = myfun(input1, input2)
Is it possible, that I can get the name "OutputName" in "myfun" and use it? It means, my function should know the name "OutputName" when it is called.
how to realize it?
thanks and regard! Zhang
Answers (1)
per isakson
on 2 Jun 2012
0 votes
The short answer is NO followed by a question WHY.
The long answer is maybe:
- dbstack(2) has the name of the caller and the line number
- which('name') will provide the full file specification
- read the file and parse the line
but why would you want to do something like that?
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!