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.
I.e.
function out = varname(var)
out = inputname(1);
end
Then
GRUMPY = 500;
name = varname(GRUMPY)
will give you what you want.