Azzera filtri
Azzera filtri

Matlab figure

1 visualizzazione (ultimi 30 giorni)
Bahareh
Bahareh il 30 Dic 2011
Hello All,
I have a matlab figure consists of two plots in one graph. I would like to split them into two graphs using subplot(). Can anybody tell me how I can do it without having the code? Thanks.

Risposta accettata

Matt Kindig
Matt Kindig il 30 Dic 2011
All of the data that is presented in the figure is provided in the figure file itself, so you don't need the original M-file that generated the figure. You can use MATLAB's various handle functions to get the data. For example,
1. Click on one of the line objects (data traces) in the figure.
2. At the command prompt, type:
h = gco;
This creates a variable "h" with the handle for the currently selected object.
3. Define two new variables x and y as:
x = get(h,'XData');
y = get(h,'YData');
This is now the data for that figure.
Now define a new figure, and plot this data, i.e.:
figure();
subplot(1,2,1);
plot(x,y);
Do this for all of the data traces that you need, making sure to use subplot appropriately.
EDIT: Editted to improve formatting.

Più risposte (1)

Jan
Jan il 30 Dic 2011
You can save the figure as a fig-file and load it again using load, because fig-files are written in the MAT-file format. Then you find all required values in the fields of the imported struct.
data = load('filename.fig', '-mat')
I admit, this is not convenient, but exhaustive.
  1 Commento
Bahareh
Bahareh il 31 Dic 2011
Thanks a lot Mr. Jan!

Accedi per commentare.

Categorie

Scopri di più su Graphics Object Identification in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by