Академический Документы
Профессиональный Документы
Культура Документы
alens blog
03/09/13
fighandle = openfig(myfigure.fig), which is basically the same as gcf if we open the figure first. Then we can do the same thing as in 1. get(get(fidhandle,Children),Children),XData) 3. We dont open the figure, but load the figure file into a struct variable. myFigStruct = load(myfigure.fig,'-MAT) ; or myFigStruct = load(-MAT,myfigure.fig); Note: the root element of the figure is called hgS_070000 for Matlab7+ figures its called something else for figures saved in Matlab6- (probably hgS_06 or something). Then find the data element in the hierarchy, like XData: myFigStruct.hgS_070000.children.children.properties.XData 4. Save the data of the figure file to a .mat file. open .fig file. saveas(gcf,mydata,'mmat) %save data of the .fig file to .mat file called mydata.mat load mydata The object variable mat now contains all your data. To extract it from it, do: x1=mat{1}, x2=mat{2} etc. 5. If the figure is a line, we can also use findobj or findall from the figure handle. fighandle=openfig(myfigure.fig); ax=findall(fighandle,Type,'line); x=get(ax,XData); y=get(ax,YData); or s=hgload(myfigure.fig); h = findobj(s,Type,'line); x=get(h,xdata); y=get(h,ydata);
alenblog.wordpress.com/2009/07/21/retrieve-data-from-fig-matlab-figure-file/
2/4
03/09/13
Filed under: Computer, Matlab, Programming Tagged: | Matlab view.atdmt.com spyware removal Microsoft Office 2007 Save as PDF or XPS
11 Responses
T, on October 28, 2009 at 4:27 pm said: This is very useful thank you. Reply mahdi, on September 21, 2010 at 10:52 am said: hi,I am work by ice and guide function in matlab.but I cannt work them and I dont know ice.fig file please help me tanks alot Reply cunyalen1, on September 21, 2010 at 1:40 pm said: Could you please describe your problem more detailedly? Reply mahdi, on September 22, 2010 at 4:46 am said: I cannt work by ice function. what s method work of this function ?tanks alot
cunyalen1, on September 22, 2010 at 12:27 pm said: I dont find any ice function in matlab. Is it because Im using different matlab version? And, could you let me know what you want to do with ice functions? You mentioned guide before. You have problems using guide also? Is it the same one problem with ice?
alenblog.wordpress.com/2009/07/21/retrieve-data-from-fig-matlab-figure-file/ 3/4
03/09/13
mahdi, on September 21, 2010 at 10:56 am said: hi,I am work by ice and guide function in matlab.but I ate my trouble. please help me.tanks alot. Reply Fernando, on March 30, 2011 at 9:12 pm said: Thank you, your article was very helpful for me Reply Ad, on June 1, 2012 at 5:23 pm said: Thanks a lot!! I had the figure but I lost the data, so your article was very helpful. Reply Child swapping | Matlabtips.com , on December 23, 2012 at 5:39 am said: [...] Another alternative was to use each figure handle and access the underlying data through their XData and YData fields. But this was not the most elegant solution. Then we remembered that figure handles are [...] Reply wewqew , on May 2, 2013 at 3:14 pm said: Nice contribution. Reply twita, on August 16, 2013 at 5:47 pm said: Gratters your tutorial is very usefull. thanks! Reply
alenblog.wordpress.com/2009/07/21/retrieve-data-from-fig-matlab-figure-file/
4/4