After plotting the figure, one may save it as f.fig for later use. My
questios are as following:
1. To restrive the plot of F.fig, I need to run MatLab and then manually
open it by clicking it in
MatLab for PCWin. Is there any way that I can see the figure by
clicking the F.fig file in MS Win's
EXPLORER.EXE? Just like I do it for opening the *.m file?
2. In the saved F.fig, I use plot(x,y) but now I would like to have it to
show me as loglog(x,y).
How can I do that in the case that all I have is the F.fig without read
the original x and y data?
3. Suppose I have F001.fig, F002.fig, ...., F100.fig. In each file, I saved
the plot(x,y001), plot(x, y002),
...., plot(x,y100). Now, sometime later, I would like to have
plot(x(3)*ones(1,100), Y). Here the
objective Y is the array containing the data for [y001(3), y002(3), ....,
y100(3)]. How can I do this
in the case that all I have are those F*.fig files?
Thanks,
by Cheng Cosine
Jan/21/2k2 UT
Hi Cheng,
I don't _believe_ so -- the reason the .m file opens is that the extension
is associated with the MEDITOR, which recognizes the format of the m-file.
I don't know if Explorer will recognize the .fig format.
> 2. In the saved F.fig, I use plot(x,y) but now I would like to have it to
> show me as loglog(x,y).
>
> How can I do that in the case that all I have is the F.fig without
read
> the original x and y data?
You can use handle graphics to retrieve the X and Y data from the lines in
the axis. Use the FINDOBJ function to find objects of Type Line and GET its
XData and YData.
> 3. Suppose I have F001.fig, F002.fig, ...., F100.fig. In each file, I
saved
> the plot(x,y001), plot(x, y002),
>
> ...., plot(x,y100). Now, sometime later, I would like to have
> plot(x(3)*ones(1,100), Y). Here the
>
> objective Y is the array containing the data for [y001(3), y002(3),
....,
> y100(3)]. How can I do this
>
> in the case that all I have are those F*.fig files?
See answer 2 on retrieving the X and Y data.
--
Steve Lord
sl...@mathworks.com
Would you give an example?
You can associate fig files with matlab, but a new instance of matlab
will be invoked each time you open a figure.
Hi Cheng,
Here's a simple example:
plot(1:10,10:-1:1)
saveas(gcf,'MyTestFig.fig','fig')
close(gcf)
% The above generates the figure, saves it, and closes it
% This is just for setup of the example
% In an actual application, these may have been done a long time ago
% and the data from the first command may have been lost
openfig('MyTestFig.fig');
HandlesOfLines=findobj(gcf,'type','line');
% This reopens the figure and finds the Line object inside it
XData = get(HandlesOfLines,'Xdata')
YData = get(HandlesOfLines,'Ydata')
% This retrieves the X and Y data, which are:
XData =
1 2 3 4 5 6 7 8 9 10
YData =
10 9 8 7 6 5 4 3 2 1
As you can see, these are the inputs we passed to the PLOT command.
You may have some issues with finding the right line from which to retrieve
the X and Y data if you have multiple lines in the figure ... but hopefully
they have some other distinguishing characteristic that you can use with the
FINDOBJ command.
--
Steve Lord
sl...@mathworks.com
I already tried to associated *.fig to MatLab, but only MatLab pop out. No
figure will be displayed.
by Cheng Cosine
Jan/22/2k2 UT