Saving graphs while preserving all their characteristics
3 ビュー (過去 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
2012 年 3 月 11 日
It would help if you show the code you use to generate and save the plot.
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
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.
参考
カテゴリ
Help Center および File Exchange で Get Started with Control System Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!