I have drawn two Axes in GUIDE.
How can I assign each of my plots to one of them?
when I now run it, MATLAB just put both plots on one another.

 Akzeptierte Antwort

Jan
Jan am 21 Feb. 2017

3 Stimmen

Use the handles of the axes objects:
plot(1:10, rand(1, 10), 'Parent', handles.axes1)
plot(1:10, -rand(1, 10), 'Parent', handles.axes2)
This assumes, that your axes have the names "axes1" and "axes2" (I don't know if this is the standard in GUIDE) and that they are stored in the handles struct, which should be available in your callback.

2 Kommentare

Rightia Rollmann
Rightia Rollmann am 21 Feb. 2017
Bearbeitet: Rightia Rollmann am 21 Feb. 2017
Thank you! But still one problem:
Imagine what is to be shown is stored in a struct. How can I tell MATLAB that show plot this struct in a certain Axes? Detailed Explanation here.
Jan
Jan am 21 Feb. 2017
Bearbeitet: Jan am 21 Feb. 2017
You can assign the Parent property also using the dot notation:
R = rectangle;
R.Position = [X Y W H];
R.Parent = handles.axes2;
This is equivalent to:
R = rectangle('Position', [X Y W H], 'Parent', handles.axes2);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 21 Feb. 2017

Bearbeitet:

Jan
am 21 Feb. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by