![]() For example, the statement,ĭefines a default value on the Root level that causes the created Figure to use noninteger handles whenever you (or MATLAB) create a Figure. You must define this property as a default value for Figures. This property defines a callback routine that executes when MATLAB creates a Figure object. CreateFcn stringĬallback routine executed during object creation. See colormap and ColorSpec for more information. Colormaps affect the rendering of Surface, Image, an d Patch objects, but generally do not affect other graphics objects. The default Figure colormap contains 64 predefined colors. Colormaps can be any length (up to 256 only on MS-Windows and Macintosh), but must be three columns wide. ![]() For example, an index of 1 specifies the first RGB triplet, an index of 2 specifies the second RGB triplet, and so on. MATLAB accesses colors by their row number. This property is an m-by-3 array of red, green, and blue (RGB) intensity values that define m individual colors. Colormap m-by-3 matrix of RGB valuesįigure colormap. You can specify a color using a three-element vector of RGB values or one of MATLAB's predefined names. This property controls the Figure window background color. MATLAB then uses this setting for the CloseRequestFcn of all subsequently created Figures. Set(0,'DefaultFigureCloseRequestFcn','my_closereq') To make this M-file your default close request function, set a default value on the Root level: Set(figure_handle,'CloseRequestFcn','my_closereq') Now assign this M-file to the CloseRequestFcn of a Figure: Selection = questdlg('Close Specified Figure?'. The following M-file illustrates how to do this: A more useful application of the close request function is to display a question dialog box asking the user to confirm the close operation. Unless the close request function calls delete, MATLAB never closes the Figure. This close request function never closes the Figure window it simply echoes "This window is immortal" on the command line. Set(gcf,'CloseRequestFcn','disp(''This window is immortal'')') You can set CloseRequestFcn to any string that is a valid MATLAB statement, including the name of an M-file. ![]() closereq takes advantage of the fact that the close command makes all Figures specified as arguments the current Figure before calling the respective close request function. This statement unconditionally deletes the current Figure, destroying the window. The default function is named closereq and is predefined as: The close operation executes the function defined by the Figure CloseRequestFcn.A user issues the close command from the command line or by closing the window from the computer's window manager menu.It allows you to, for example, display a dialog box to ask a user to confirm or cancel the close operation or to prevent users from closing a Figure that contains a GUI. The CloseRequestFcn provides a mechanism to intervene in the closing of a Figure. This property defines a function that MATLAB executes whenever you issue the close command (either a close(figure_handle) or a close all) or when you close a Figure window from the computer's window manager menu. CloseRequestFcn stringįunction executed on Figure close. Figure Properties (MATLAB Function Reference) MATLAB Function Referenceįigure Properties This section lists property names along with the type of values each accepts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |