Next: LET /WHERE
Up: SIC Language Internal Help
Previous: IF
LET
[SIC\]LET Variable = Expression [/NEW Type [Attr]]
[SIC\]LET Variable = Expression /WHERE Conditionmask
[SIC\]LET Variable [= Expression] /PROMPT "Explanatory text"
[SIC\]LET Variable [= Expression] /RANGE Min Max
[SIC\]LET Variable [= Expression] /CHOICE Value_1 Value_2 ...
Value_n
[SIC\]LET Variable [= Expression] /INDEX Value_1 Value_2 ... Value_n
[SIC\]LET Variable [= Expression] /FILE Filter
Assigns a value to a variable. The variable must already be defined (see
DEFINE) unless the /NEW option is present. In this case, Type is the
type of the variable (REAL, INTEGER, DOUBLE for double precision, or
LOGICAL). Logical expression results cannot be assigned to non logical
variables, and vice versa. All numerical expression evaluations are done
in double precision, and automatically converted to the type of
(numerical) variable assigned.
The Attr argument is used to specify whether the newly created variable
is LOCAL (default) or GLOBAL. If no value is assigned to the Variable,
the user will be prompted for the variable value.
VECTOR OPERATION:
Operations are vectorial, i.e. a full array is computed at the same
time. The variable name can define a subset of an known array, such as:
DEFINE REAL A[4,5,6] B[4]
LET A[,,3] = 1.0 ! or equivalently LET A[3] = 1.0
LET A[,2,2] = B ! or equivalently LET A[2,2] = B
these commands assign the value 1.0 to A[i,j,3], with i running from 1
to 4 and j from 1 to 5, and B[k] to A[k,2,2] for k from 1 to 4. Implicit
transposition is now allowed, though still somewhat experimental: both
A[,2,3] and A[2,,3] are valid. A range of indexes can be specified
rather than one index: for the above example A[3:5] is a valid 4x5x3
array, A[2:4,,] is a 3x5x6 array.
IMPLICIT LOOPS:
In addition to vector computing, it is possible to assign an array using
"implicit loops", i.e. functions of the array indices such as
DEFINE REAL A[4,5]
LET A[I,J] = (I-J)**2
Implicit loops cannot be mixed with variable index values.
CONDITION MASK (/WHERE option):
Vector assignment can be done only where a specified logical array (or
logical array expression) is true, using the /WHERE option. See HELP LET
/WHERE.
FREE SYNTAX:
The LET command may be omitted if no option is present, and is the SIC
syntax is set to FREE. In case of conflict between a variable name and a
(complete) command name, an error message is issued. See SIC command.
GUI (Graphic-User-Interface) input mode:
If command GUI\PANEL has been issued before, the LET command defines
widgets in the master window defined by GUI\PANEL. The widget is a
simple prompt when option /PROMPT is set, a slider if option /RANGE is
present, a list of choices if option /CHOICE or /INDEX is given, and a
selection of files with the specified filter when option /FILE is
specified. If neither of these options is present, the LET command
works in the usual way.
The widgets are created and activated by command XGO. Standard input can
be used, and pressing button GO will define all the variables as
specified. If button ABORT is pressed instead, none of the variables are
modified and an error is returned. Error handling is available.
Gildas manager
2001-04-18