Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: getting the data out of Matlab fig
Date: Tue, 28 Apr 2009 17:25:07 +0000 (UTC)
Organization: Ohio University
Lines: 36
Message-ID: <gt7e5j$iqo$1@fred.mathworks.com>
References: <gsiuva$sv8$1@fred.mathworks.com> <gsqd8r$ke4$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1240939507 19288 172.30.248.37 (28 Apr 2009 17:25:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 28 Apr 2009 17:25:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 335850
Xref: news.mathworks.com comp.soft-sys.matlab:535995


"Tingyue Gu" <gu@ohio.edu> wrote in message <gsqd8r$ke4$1@fred.mathworks.com>...
> "Mahdieh" <mahdieh.emrani@capitalhealth.ca> wrote in message <gsiuva$sv8$1@fred.mathworks.com>...
> > I have saved 50 2D simple graphs as a Matlab .fig(s).
> > Now I need to get the data out of the graphs, i.e. XY of the data points ...
> > I just need to know how to get the data for one graph.
> > 
> > Any help is appreciated, 
> > Thanks, 
> > -Mahdieh
> 
> Hello for Tingyue Gu, 
> I wrote a free GUI utility called "MfigExtract" just to do that job. The target figure can contain multiple curves. x-axis ranges for the curves do not have to be the same! Output file is an .xls file (actually a text file with this extension) that can be opened using Excel or notepad. The data can be readily re-plotted in Excel. 
> 
> This utility requires MATLAB R14 or above to run. I made the source code freely available. Search the web using keywords "extract x y data from matlab figure." If you cannot find it, find my home page using my name. 
> 
> You can also save the following lines into an m-file to run it. 
> 
> [filename1 pathname1]=uigetfile('*.fig','Select a figure file to extract x-y data');
> if isequal(filename1,0) | isequal(pathname1,0); return; end %User pressed Cancel
> 
> [filename2, pathname2] = uiputfile('*.xls', 'Provide an Excel file name to save the x-y data');
> if isequal(filename2,0) | isequal(pathname2,0)
>     return
> end %User pressed Cancel
>     
> if isempty(strfind(filename2,'.xls'));
>     filename2=[filename2 '.xls'];
> end
> 
> s = openfig(filename1); % open figure and get handle to figure

s = openfig(filename1) 
should be replaced by 
s = openfig(fullfile(pathname1,filename1))

Cheers!