Matlab get string containing variable name<>
This question already has an answer here:
- print variable-name in Matlab 4 answers
MATLAB doesn't provide built-in functionality for this, but there is a workaround, as employed here
Essentially, you have to create your own function to do this. Take advantage of Matlab's functionality for getting the variable name of the INPUT ARGUMENT to a function.
function out = varname(var) out = inputname(1); end
GRUMPY = 500; name = varname(GRUMPY)
will give you what you want.
If I understand correctly you should try