Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB : how to get the data from a .fig file ?

  1. Nov 8, 2005 #1
    MATLAB : how to get the data from a .fig file ???

    Hello everybody !

    I ve a problem on matlab : I have 5 .fig files generated and I want to plot all the curves on 1 unique .fig file can u tell me how to do or how to get the data from one .fig file ?

    thanks a lot

    serialtom
     
  2. jcsd
  3. Nov 11, 2005 #2
    use the command "hold on" to plot all your data onto one figure area. Then "hold off" to make a new figure in a new area.
     
  4. Jan 5, 2010 #3
    Re: MATLAB : how to get the data from a .fig file ???

    [filename,directory]=uigetfile()
    picture=open([directory,filename])
    axs=get(gcf,'Children')
    % you may have to start poking around at the different axs(n) to get the right one
    pos=get(axs(2),'Children')
    % same with the pos(n), especially if you labelled your plots or have more than one line
    x1=get(pos(1),'Xdata')
    y1=get(pos(1),'Ydata')

    repeat this process for all the .fig files you have, naming each successive one x2 and y2, or whatever you choose then...

    figure
    hold on
    plot(x1,y1,'-b')
    plot(x2,y2,'-r')
    ...
    plot(xn,yn,'-k')
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: MATLAB : how to get the data from a .fig file ?
Loading...