I have a function in Matlab that has some variables in it. I need to print out the variable_names (in case of an exception etc.). I am aware of inputname func
inputname
varname=@(x) inputname(1); disp(['Error in var: ' varname(mat)])