Display two figures in two different axis using matlab gui

12 ビュー (過去 30 日間)
Elena Martín
Elena Martín 2019 年 3 月 4 日
回答済み: Kevin Phung 2019 年 3 月 4 日
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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by