User`s guide
Add Code for Components in C allbacks
Note For information about properties that you can set to control many
aspects of axes behavior and appearance, see “Axes Objects — Defining
Coordinate Systems for Graphs”.
If your GUI contains axes, you should make sure that the Command-line
accessibility option in the GUI Options dialog box is set to Callback (the
default). From the Layout Editor select Tools > GUI Options > Command
Line Accessibility: Callback. See “C om mand-Line Accessibility” on pa ge
5-11 for more information about how this option works.
Creating Subplots
Use the subplot function to create axes in a tiled pattern. If your
GUIDE-generated GUI contains components other than the subplots, the
subplots must be contained in a panel.
As an example, the following code uses the
subplot function to create an
axes w ith two subplots in the panel with
Tag property uipanel1.Thiscode
is part of the Plot push button
Callback callback. Each tim e you press the
Plot button, the code draws a line in each subplot.
a1 and a2 are the handles
of the subplots.
a1=subplot(2,1,1,'Parent',handles.uipan el1);
plot(a1,rand(1,10),'r');
a2=subplot(2,1,2,'Parent',handles.u ipanel1);
plot(a2,rand(1,10),'b');
8-47