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

  • Thread starter serialtom
  • Start date
1
0
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,903
13
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.
 
1
0
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')
 

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

Replies
1
Views
4K
Replies
1
Views
3K
Replies
5
Views
8K
Replies
4
Views
12K
Replies
3
Views
2K
Replies
2
Views
6K
Replies
7
Views
763

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top