Effacer les filtres
Effacer les filtres

Saving graphs while preserving all their characteristics

4 vues (au cours des 30 derniers jours)
Edwin Fonkwe
Edwin Fonkwe le 10 Mar 2012
Modifié(e) : Zachary le 3 Août 2020
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 commentaires
Daniel Shub
Daniel Shub le 11 Mar 2012
It would help if you show the code you use to generate and save the plot.
Zachary
Zachary le 3 Août 2020
Modifié(e) : Zachary le 3 Août 2020
+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

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 11 Mar 2012
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 commentaire
Edwin Fonkwe
Edwin Fonkwe le 11 Mar 2012
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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Plot Customization dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by