Saving graphs while preserving all their characteristics

4 次查看(过去 30 天)
Hello everyone,
I have this problem. Whenever I generate a plot using the "step" or "bode" commands for example and I save the figure, the next time I try to open it, all the characteristics are lost (like "peak response", "settling time", etc). So, I'm forced to do another "step" or "bode" plot. How do I save a plot while preserving all the characteristics?
I appreciate your help in advance.
e.
  2 个评论
Daniel Shub
Daniel Shub 2012-3-11
It would help if you show the code you use to generate and save the plot.
Zachary
Zachary 2020-8-3
编辑:Zachary 2020-8-3
+1 this question! I have never been able to share the rich interactive figures (i.e. the context menus) generated by the Control System Toolbox. I always have to share the script that generates the figure instead. Sometimes this is impractical.
Here is an example of the problem...
%Generate a response plot
fh = figure; %figure handle
ph = bodeplot(rss(1)); %resppack.bodeplot handle
savefig runs successfully on the figure handle, but I lose the the context menu and the resppack.bodeplot object.
savefig(fh) %only saves graphics
savefig errors on the bodeplot handle because ph isn't a figure handle.
savefig(ph) %errors
save runs with a warning because I should be using savefig for a figure. When loading fh or ph, I get stuck in an endless loop of listener warnings and the figure window opens multiple times (all of which lack context menus).
save myfile.mat fh ph %warning to use savefig instead
load myfile.mat fh %endless loop of warnings
load myfile.mat ph %endless loop of warnings

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2012-3-11
You might want to have a variable, a structure, called something like GraphSettings. Then you could save all the parameters in a single variable and then save it to a mat file and recall it easily. Like
GraphSettings.peakResponse = 42;
GraphSettings.settlingTime = 10;
GraphSettings.LineWidth = 2;
GraphSettings.LineColor= 'r';
% To save:
save('myAppsSettings.mat', 'GraphSettings');
% To recall
s = load('myAppsSettings.mat');
GraphSettings = s.GraphSettings;
Then you use GraphSettings to rebuild your graph. You might want to have a function called something like "BuildGraph" that does everything necessary to build your graph from the data and the other settings saved in GraphSettings.
  1 个评论
Edwin Fonkwe
Edwin Fonkwe 2012-3-11
Thanks for ur response, though it doesn't quite solve my problem.
Say I define the transfer function:
G = tf(1,[1 1]) and I use the command:
bode(G);
From the resulting figure, I click File->Save As. As long as the figure is open, I can always right-click and show peak response, and minimum stability margins. If I close and re-open the figure, it is no longer possible to show these characteristics. So, is it possible, (from the figure), to save the plot with all its characteristics? I hope my problem is clearer.
regards

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Plot Customization 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by