commode

commode#

Purpose

General purpose command parser for user interface command functions.

Syntax

Commode ('CommandFcn','ChainOfCommands') 

Description

Commands and options are central to SDT. These strings are passed to functions to allow multiple variations in behavior. Accepted commands are listed in the help (text) and sdtweb (html) documentations (see iicom, fecom, feutil, etc.).

  • commands are case insensitive, thus FindNode and findnode are equivalent. The uppercase is used to help reading.
  • options can be separated by blanks : 'ch1' or 'ch 1' are the same.
  • option values (that must be provided) are indicated italic in the HTML help and in brackets () in the text help.

    For example ch i indicates that the command ch expects an integer. ch 14 is valid, but ch or ch i are not.

  • in the help alterative options are indicated by [c1,c2] (separated by commas).

    For example ch[,c] [i,+,-,+i,-i] means as a first alternative that ch and chc are possible. Then alternatives are i a number, + for next, - for previous, +i for shift by i. ch 14, chc 12:14, chc+, ch-2 are all valid commands.

  • Commands are text strings so that you can use fecom ch[1,4], fecom 'ch 14' or fecom('ch 1 4') but not fecom ch 1 4 where ch, 1 and 4 are interpreted by MATLAB as 3 separate strings.
  • ; placed at the end of a command requests a silent operation as in MATLAB.
  • When building complex commands you may need to compute the value used for an option. Some commands actually let you specify an additional numeric argument (feplot('textnode',[1 2 3]) and feplot('textnode 1 2 3') are the same) but in other cases you will have to build the string yourself using calls of the form feplot(['textnode' sprintf(' %i',[1 2 3])])

The UI command functions only accept one command at a time, so that commode was introduced to allow

  • command chaining: several commands separated by semi-columns ;. The parsing is then done by commode.
  • scripting: execute all commands in a file.
  • command mode: replace the MATLAB prompt >> by a CommandFcn> which directly sends commands to the command function(s).

Most command functions send a command starting by a ';' to commode for parsing. Thus commode ('iicom','cax1; abs') is the same as iicom (';cax1;abs')

The following commands are directly interpreted by commode (and not sent to the command functions)


q,quitexits the command mode provided by commode but not MATLAB .
script FNamereads the file FName line by line and executes the lines as command strings.

The following syntax rules are common to commode and MATLAB


%commentall characters after a % and before the next line are ignored.
[]brackets can be used to build matrices.
;separate commands (unless within brackets to build a matrix).

See also

comstr, iicom, fecom, femesh