1
% @(#)computtabl.hlq 19.1 (ESO-IPG) 02/25/03 14:03:04
2
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3
%.COPYRIGHT (c) 1990 European Southern Observatory
6
%.KEYWORDS MIDAS, help files, COMPUTE/TABLE
7
%.PURPOSE On-line help file for the command: COMPUTE/TABLE
8
%.VERSION 1.0 05-Aug-1992 : Creation, MP
9
%----------------------------------------------------------------
13
COMPUTE/TABLE 05-Aug-1992 MP
15
COMPUTE/TABLE table column = expression
16
compute arithmetic or string operations on table columns
19
Perform arithmetic or string operations on columns in a table.
20
The output column will be created if it doesn't exist.
23
Table, column, arithmetic, string
26
COMPUTE/TABLE table column = expression
30
column = output column, either already existing or a new one
31
created by the command (In that case, the column has
32
to be referred to by label) .
34
expression = FORTRAN compatible expression , in
35
which the variables are columns in the table.
38
Note: Expression may contain arithmetic operators, logical operators
39
and mathematical functions.
40
The supported arithmetic operators are +, -, *, / and **.
41
The supported mathematical functions are :
43
SQRT(:a) LN(:a) LOG10(:a) EXP(:a) SIN(:a) \\
44
COS(:a) TAN(:a) ASIN(:a) ACOS(:a) ATAN(:a) \\
45
SINH(:a) COSH(:a) TANH(:a) ABS(:a) INT(:a) \\
46
MIN(:a,:b) MAX(:a,:b) MOD(:a,:b)
48
Arguments of trigonometric functions are in degrees. The function
49
INT produces the nearest integer value. The function MOD returns
50
the floating-point remainder of a/b with the same sign as a.
52
The supported logical operators are .AND. .OR. .NOT.
54
String operations can be performed on character columns:
56
TOLOWER(:a) convert all characters in the column to uppercase
57
TOUPPER(:a) convert all characters in the column to lowercase
58
COLLAPSE(:a) remove all spaces from the contents of the column
60
CONCAT(:a,s) concatenate the contents of two columns
61
or of one column and one string into an output column
63
The function TOCHAR(:a) can be used to convert the values of a
64
column with any numerical type into strings, using the output
65
FORTRAN format associated to the input column.
67
The variable name SEQUENCE (short form SEQ) can be used as
68
variable, refering to the sequence number of the table entries.
70
The variable name SELECT (short form SEL) can be used as
71
variable, refering to the select flag of the table entries
72
(The value will be 0 or 1 according to whether or not the
73
entry is selected). This variable can be used to perform
74
computations only on the selected entries of the table.
75
Please, note, that for variables SEQUENCE and SELECT we should
76
NOT have a colon(`:') in front.
79
If the output column doesn't exist, it will be created and
80
its type will be the same as the "highest" one of the input
83
The result of an illegal operation (i.e logarithm of a negative
84
number) will be set to the NULL value.
86
The SELECT mask will be reset by this command, i.e., before the
87
computation, all the elements in the table are selected.
90
CREATE/COLUMN, WRITE/TABLE, SELECT/TABLE, COMPUTE/IMAGE
94
COMPUTE/TAB mytable :MAG = 21.3-2.5*LOG10(:INTEN-:BACK)
95
Compute for table `mytable.tbl' the resulting column :MAG from
96
the expression involving the input columns :INTEN and :BACK.
98
COMPUTE/TAB mytable :R = 0.5*SEQ
99
Compute resulting column :R from the expression involving
100
the sequence number of the table entries.
102
SELECT/TAB mytable :MAG.LT.110.
103
COMPUTE/TAB mytable :Z = MIN(:MAG,:R)+SEL
104
Compute resulting column :Z as follows:
106
compute for each row the minimum value of the column :MAG and
107
the column :R and add to the result the selection flag of the
110
COMPUTE/TAB mytable :NAME = CONCAT(:STAR,TOCHAR(:SEQ))
111
For each row of the table myname, convert the value of the
112
column labeled :SEQ into a string, concatenate it to the
113
contents of the column :STAR and store the result into the
116
Here we use a column labeled :SEQ not the sequence numbers!