Display two figures in two different axis using matlab gui

10 次查看(过去 30 天)
Hi everyone,
I'm having some trouble using two axis in the same matlab gui, I attach my code so the question is clear: the thing is when a button is pushed the function Electrodes_Brain returns a figure which i need to set to an axis. I have two axis and two buttons so I expect to get one figure in each axis but that doesn´t happen, when a second button is pushed the figure is set to the same axis. I'm also attaching a screenshot of the result I obtain. If someone knows what the problem is please let me know. Thanks!Captura.JPG

采纳的回答

Kevin Phung
Kevin Phung 2019-3-4
what you can do is assign a tag to your axes when you create them, and point back to them in your callback functions.
here's an example:
a = axes;
a.Tag = 'ax1';
b=axes;
b.Tag = 'ax2'
Now, within your callback:
a= findobj(gcf,'Tag','ax1');
b = findobj(gcf,'Tag','ax2');
plot(a,x,y)
plot(b,x2,y2)
if your axes are in the same function as your callback function, you dont need to assign any tags or look for them, just pass the handle as the first argument
plot(a,x,y)
plot(b,x2,y2)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by