March 17, 2011
Matlab GUI With Multiple Axes
We can create Matlab with multiple axes with command subplot. Example :
subplot(2,2,1); plot(x1,y1); subplot(2,2,2); plot(x1,y4); subplot(2,2,3); plot(x1,y4); subplot(2,2,4); plot(x1,y4);
Output image from this Matlab with multiple axes code is :
But when we create a gui program (with GUIDE) in matlab, we can not create Matlab GUI with multiple axes directly. This is a trick how to create plot Matlab GUI with multiple axes.
- Open matlab gui figure and add panel.
- Add axes in top of panel.
- This is a Matlab GUI with Multiple axes design
Add this script to you m-file from this GUI generated :
subplot(2,2,1, 'Parent',handles.uipanel1) subplot(2,2,2, 'Parent',handles.uipanel1) subplot(2,2,3, 'Parent',handles.uipanel1) subplot(2,2,4, 'Parent',handles.uipanel1)
So, ouput from this Matlab GUI with multiple axes :
You can download the complete code for this Matlab GUI with multiple axis from this tutorial at here.
3 Comments
Wow, marvelous weblog structure! How long have you ever been running a blog for? you make blogging glance easy. The entire look of your site is excellent, neatly as the content material! Koha Ditore
Hello,
Thanks for the trick.
I am trying to define xlabel and xlim to the subplots, but it keeps on opening new figure for it.
My plot is also in a timer function, but I don’t think it’s the problem.
Do you have any idea how to solve it?
Thank you,
Liad.
can you share to me that code, so I can check your code.
Thank you