필터 지우기
필터 지우기

Saving graphs while preserving all their characteristics

조회 수: 4 (최근 30일)
Edwin Fonkwe
Edwin Fonkwe 2012년 3월 10일
편집: Zachary 2020년 8월 3일
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