MATLAB: Saving figures into structure

figurestructures

Is it possible to save a figure into a structure? I'm trying to figure out how to save both data and figures into a single entity that I could then load in matlab. I know data can be saved in .mat and figures can be saved as .fig but is there not a way to save both in a single container?

Best Answer

Hey Jared,
data = rand(10,2);
myStruct.structFig = plot(data);
myStruct.structData = data;
m = figure(2);
% does not actually work
% % set(m,myStruct.structFig.XData,'XData');
you should have a look at the set() command. I haven't found a solution yet. Easiest would be just plot the data again but here you loose all of your preset defines like thickness and such things.