Saving a figure as a png with a specific name from predefined variable
13 views (last 30 days)
Show older comments
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.
1 Comment
Jan
on 22 Jan 2019
"Invaluid filename" is a surprising message. If plottitle is a string, which contains the name of the file, plottitle.bmp is interpreted as the access of the field bmp of a struct. Then the error message should be different.
It is recommended to post running examples. As soon as you show how plottitle is defined, the actual problem would be clear.
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!