Saving a structure with the title of a plot as name

8 views (last 30 days)
I am currently trying to get get a function that will both save a newly created figure as a .fig-file with it's title being the file name. That works so far.
However, aside from that, the structure that includes all data used for creating the figure should also be saved under the same name. With this second part, I have troubles.
Is there a way to achieve this? It would surprise me if there isn't a way to do this.
function Savefigfun(LPData)
% Savefig saves the newly created figure as a .fig-file named after the
% title of the figure. The saved figure is still editable afterwards.
if isempty(CurrentFigureTitle.String)
warning('Error occured.\nCan''t save a figure without title. Please set title before calling [Savefigfun]','class(n)')
warning off
% created by Claudius Appel.
Thank you.
Have a great day & stay safe
Claudius Appel
Claudius Simon Appel
Claudius Simon Appel on 11 Jun 2020
@Geoff Hayes
Oh, I didn't know that.
I might see which one of the two is more prone to errors.
Every day I learn something new about this program. It is awesome :)
Thank you.

Sign in to comment.

Accepted Answer

Claudius Simon Appel
Claudius Simon Appel on 12 Jun 2020
Thank you Geoff Hayes for answering the question and solving the problem.
Link to his comment:

More Answers (0)


Find more on Dialog Boxes 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!