shown in figure 1. The dialog in this figure contains only 3 grey pushbuttons (online
ident., Gr, >>) and background picture.
What to do first? You have to draw the picture in the extern software, for example in Corel
DRAW! and save it in one of the formats that Matlab supports, for instance as JPG or BMP.
You can get the list of supported formats from the Matlab Help Dialog. Don’t forget to write
down the width and height of the picture or their ratio. Create new dialog using the
command figure or by GUI. Set the size of the new window in accordance with the picture
width and height or their ratio. How? If you working with GUIDE, double-click the window
in GUIDE and Property Inspector should appear. Change the Units property on Pixels and
after that change in the Position property the third and fourth value to the width and height
of the figure or keep these values in the ratio of the picture you would like to show. If you
created the dialog using figure function in M-file, include in the list of properties Units
and Position and set them in similar way as was described for the GUI created by GUIDE.
Now you need to load the figure in the Matlab Workspace, create axes and put the figure
inside them. This tip is based on work of Perutka (Perutka, 2007). Inspire yourself by the
following code which will be commented
1 STCssu=imread('STCssu.jpg','jpg');
2 axes('Position',[0 0 1 1]);
3 image(STCssu);
4 axis off;
5 clear STCssu
Fig. 1. Dialog with picture as its background
This code should be placed in the file where the figure is defined. The line 1 of the code is
responsible of loading the picture in the Matlab Workspace using the function image. In
this case, STCssu.jpg is the name of picture file and the picture is loaded to the STCssu
variable. Line 2 creates the axes with their range just for all dialog area. Command in line 3
draws the image from the STCssu variable to the axes created by line 2. The axes description
is hidden by the command on line 4. If you don’t re-draw the dialog, you can delete the
variable from the Matlab Workspace, as it is shown in line 5. But if you re-call the dialog,
don’t use line 5. For the dialog re-calling, lines 2 to 4 are enough.
3. Short online help for every object in dialog
Imagine the situation depicted in figure 2. There is a short text “If you click this button, you
will open the dialog of setting the controller parameters.” in the box. This text is shown if
you keep the cursor on the button Gr for a while. This might be useful especially in the case
of two sorts of objects in dialog (button or edit text) to provide necessary short information
what should be written as the text (edit text) or what will happen when the button is
pressed. But short information can be displayed over every object in dialog which has the
property TooltipString.
If you created your dialog by GUIDE, open it in GUIDE again and double click the object for
which you would like to create the short help.
Fig. 2. Dialog with short help