MATLAB: Saving a figure as a png with a specific name from predefined variable

MATLABplottingpngsaveas

I would like to save a figure as a png with the name as a value that I had already predefined in the code. The code below is not calling that value. My variable that I would like to use as the name of the png is defined as plottitle.
I keep getting an error that says invalid filename.
plottitle is my variable
saveas(gcf,plottitle.bmp)
Output: Error using saveas (line 96)
Invalid filename.

Best Answer

With some guessing:
saveas(gcf, [plottitle, '.bmp'])
Related Question