Contents     Functions         Previous Next     PDF Index



General utilities for graphical user interfaces.


 comgui('Command', ...)
 cingui('Command', ...)

comgui is an open source function that the user is expected to call directly while cingui is closed source and called internally by SDT.

ImWrite, ...

ImwriteFileName.ext does a clean print of the current figure. The preferred strategy is to predefine options, so that comgui('ImWrite') alone defines options. This can be done by

comgui('ImWrite',gf,RO) with a figure handle given in gf and options stored in the RO structure, is the most general. gf can be omitted and will be taken to be gcf. RO can be omitted if options are given in the command. Acceptable options options are detailed below. For details for multi-image capture strategies (for example a set of modeshapes), see iicom ImWrite.

ImFtitle, ...

ImFtitle generates a file name for the figure based on current displayed content. Text is searched in objects with tags legend, ii_legend, in the axes title. By default all the text is concatenated and that can generate excessively long names so finer control is achieved by providing the name as a cell array in the ImWrite field of the userdata. The underlying mechanism to generate the string is described in comgui objString.

 figure(1);clf; t=linspace(0,2*pi);h=plot(t,[1:3]'*sin(t)); 
 % Define target plot directory in the figure

 % Check name generation, from string
 % Do a direct call with name building

 % Predefine the figure save name in the userdata.Imwrite of current axis
 ua=v_handle('uo',gca); % Get handle to allow setting of .ImWrite field
 ua.ImWrite={'@Plotwd','@title', ... % Search for plotwd, use title name
    '@legend(1:2)','.png'}; % use first legend entry
 % check image name, display clickable link for image generation

 % Iiplot predefine strategy
 %  - for curve : see sdtweb iiplot#PlotInfo
 % Feplot predefine strategy
 %  - for model : as above 
 %  - during .Legend display see sdtweb comgui#def.Legend


SDT uses some docking utilities that are not supported by MATLAB. The actual implementation is thus likely to undergo changes.

 gf=1;figure(gf);clf; t=linspace(0,2*pi);h=plot(t,[1:3]'*sin(t)); 
 comgui('objset',1,{'@dock','MAC'});  % Set in named dock group
 % set the dock name and position
 comgui('objset',1,{'@dock',{'name','MAC', ...
   'arrangement',[1 3],'position',[0 0 300 200],...
   'tileWidth',[.5 .25 .25]}}); 
% tileHeight also possible if arrangement(2)>1
 pos=feval(iimouse('@getGroupPosition'),'MAC'); % get group position on screen
 feval(iimouse('@deleteGroup'),'MAC') % Delete group (and figures)

Capture of a dock group figure is possible with comgui imwrite-Java3


cingui('objSet',h,Prop) is the base SDT mechanism to generalize the MATLAB set command. It allows recursion into objects and on the fly replacement. Prop is a cell array of tag-value pairs classical in MATLAB handle properties with possible modifications. Three base mechanisms are object search, expansion and verification.

Object search '@tag',value applies value to an object to determined on the fly. For example '@xlabel' applies to the xlabel of the current axis.

Expansion '','@tag' is first expanded by inserting a series of tag-value pairs resulting from the replacement of @tag. You can verify the expansion result using



 cingui('objset',1, ...       % Handle to the object to modify
   {'','@Rep{SmallWide}', ... % Predefined figure type
    '@line','@setlines(''marker'')'}) % Line sequencing


cingui('objString',h,SCell) is a mechanism to generate strings based on a set of properties. This is used by comgui ImFtitle but can also be used elsewhere.

 SCell=   {'@Plotwd/plots', ... % Search for plotwd/plot
    '@title', ... % use title name
    '.png'}; % extension 
 cingui('objstring',1,SCell) % Handle of base object


The def.Legend field is used to control dynamic generation of text associated with a given display. It is stored using the classical form of property/value pairs stored in a cell array, whose access can be manual or more robustly done with sdsetprop.

Accepted properties any text property (see doc text) and the specific, case sensitive, properties

 def.Legend={'set','legend -corner .1 .9 -reset', ... % Init
  'string',{'$title';'\it MyCube'}, ... % The legend strings
  'FontSize',12} % Other test properties
 def=sdsetprop(def,'Legend','ImWrite',{ ...
 'objSet','@Rep{SmallWide}', ... % Possible ImWrite options (optName)
  sdtdef('tempdir'), ... % directory for writting file
  'FigRoot', ... % root of figure name
  '@ii_legend([2 1])', ... % insert second and first legend lines in file name
  '.png'}) % Generate file as png
 comgui('imFTitle') % Display the file name used comgui('imwrite')


comgui('fitlabel') attempts to replace axes of the current figure so that xlabel, ylabel, ... are not cropped.

©1991-2014 by SDTools
Previous Up Next