Contents     Functions              PDF Index

## comgui,cingui

Purpose

General utilities for graphical user interfaces.

Syntax

 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. It can be called as a command with the options detailed below. The same command can be used to prepare single or multiple image capture, it is then called using comgui('ImWrite',gf,RO) with options stored in the RO structure. For details on the structure, and for multi-image capture specific options, see iicom ImWrite.

• FileName The default extension is .png. With no file name a dialog opens to select one.
• -NoCrop (or RO.NoCrop=1) avoids the default behavior where white spaces are eliminated around bitmap images.
• -FTitle (or RO.FTitle=1) uses the title/legend information to generate a file name starting with the provided filename.

A typical example would be comgui('imwrite-FTitle plots/root') which will generate a root_detail.png file in local directory plots.

For a given plot, comgui('imFTitle') can be used to check the target name.

• -LaTeX (or RO.LaTeX=1) displays LATEX commands to be used to include the figure in a file.
• -objSet"@Rep{SmallWide}" provides a tag to obtain predefined comgui objSet information to format the figure. Default formats available are
• SmallWide for a wide picture (landscape style) adapted to reports.
• SmallSquare for a square picture (4:3) adapted to reports.
• SmallHigh for a vertical rectangular picture (9:16) adapted to reports.
• LargeWide for a wide picture (landscape style) adapted to posters.
• LargeSquare for a square picture (4:3) adapted to posters.
• -clipboard copies to clipboard.
• -SubToFig copies the display to another figure before reformating (avoids modifying the current figure).
• -Java (or RO.Java=1) uses java to to a screen capture.
• -open (or RO.open=1) opens the figure in a browser.
• It is possible to give as a final argument the figure number, to ensure the corret figure it captured. This feature is mostly useful for non iiplot and feplotfigures.

### FitLabel

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

### objSet

Uniform formatting of figures is often a necessity. The cingui('objSet',h,Prop) is the SDT utility to store reusable formatting instructions. Prop is a cell array of tags and values classical in MATLAB properties with possible modifications.

• position accepts NaN for reuse of current values. Thus [NaN NaN 300 100] only sets width and height.
• @xlabel accepts a value that is a cell array that will be propagated for all x labels. A typical example would be {'@xlabel',{'FontSize',12}}. Other accepted components are @ylabel, @zlabel, @title, @axes, @text,
• @tag is assumed to search for object with the given tag, so that its properties can be set. For example {'@ii_legend',{'FontSize',12}} will set the fontsize of an object with tag ii_legend.
• @tickfcn allows a tick generation callback, see TickFcn

For the property value, a replacement mechanism is provided if the value is a string starting with @.

• The value is a default stored in sdt_table_generation('Command'). One can search values by name within a cell array. This is in particular used for preset report formats @Rep{SmallWide} in comgui ImWrite.
• The value is obtained as the result of a callback '@setlines(”marker”)' or '@out=setlines(”marker”);'. This is illustrated in the example below.
• an empty type such as ”,'@Rep{SmallWide}' is used to obtain predefined lists of properties.
 figure(1);t=linspace(0,2*pi);h=plot(t,[1:3]'*sin(t));
cingui('objset',1, ...       % Handle to the object to modify
{'','@Rep{SmallWide}', ... % Predefined figure type
'@line','@setlines(''marker'')'}) % Line sequencing


### def.Legend

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 ensitive, properties

• set gives the initalization command in a string. This command if of the form 'legend -corner .01 .01 -reset' with
• cornerx y gives the position of the legend corner with respect to the current axis.
• -reset option deletes any legend existing in the current axis.
• string gives a cell array of string whos rows correspond to lines of the legend. $title is replaced by the string that would classically be displayed as label by feplot. • ImWrite can be used to control file name generation (later used in automated multiple figure generation, see iicom ImWrite). The format in this case is a cell array giving the target directory followed by components used to build the string. Numbers then indicate rows of the legend text.  [model,def]=hexa8('testeig');cf=feplot(model); def.Legend={'set','legend -corner .1 .9 -reset', ... % Init 'string',{'\it MyCube';'$title'}, ... % The legend strings
'FontSize',12} % Other test properties
def=sdsetprop(def,'Legend','ImWrite',{sdtdef('tempdir'),'FigRoot', ...
2,1, ... % insert second and first legend lines in file name
'.png'}) % Generate file as png
cf.def=def;
comgui('imFTitle') % Display the file name used comgui('imwrite')