MATLAB: How can I use a name of an external variable in a function

function

Hi,
with the following function:
function savefigure(data)
imagesc(data)
saveas(1,['nameofthevariabledata.png']);
I would like to the image under the name of the variable. In an example: I have a matrix "we13", so I call the function with
savefigure(we13)
and I hopefully the function saves the figure as "we13.png". I don't know how to give the name of the variable (in this case "we13") to the function, so I can use it in the function. I hope someone has an idea. Thaks a lot Jim

Best Answer

help inputname