Data editing > Basic elements > Subscription
 
Subscription
You can refer to specific variables in integer and real arrays and cells or columns in data arrays by naming their position in the array.
For example:
c1
is the first column of the C array
t5
is the fifth variable in the T array
time3
is the third variable in the array called time
seg(2)
is the second variable in the array called seg
Variables within an array may also be referred to using any arithmetic expression. In this case, parentheses must be used. For example:
Example
Description
c(t1)
The column number depends on the value of t1. If t1 has a value of 10, then the variable is c10; if t1 is 67, the variable is c67.
c(t4,t5)
The field delimiters depend on the values of t4 and t5. If t4 has a value of 12 and t5 has a value of 19, the column field referred to is c(12,19).
t(c4)
The variable number depends on the value in c4. If c4 contains a single code in the range 1 to 9, the integer variable will be one of t1 to t9 depending on the exact value in c4. If c4 is multicoded, then the result is nonsense.
time(c4*23)
The variable number is the result of multiplying the value in c4 by 23. As in the previous example, c4 must be single-coded in the range 1 to 9 for this example to make sense. Thus, if c4 contains just a 4, the value of the expression is 92 so the variable referred to is time92.
When variables are referenced in this way, the value of the expression must be positive. The expression c(t1-5) is acceptable as long as t1 is at least 5. If the expression has a zero or negative value, Quantum issues an array dimension error when it comes to read the data during the datapass. Also, if the variable refers to columns, the value of the subscript must not exceed 32,767.
These are called subscripted variables and they greatly increase the flexibility with which you can write your edit.
Note Subscription can be used in repetitive processes to save you writing the same thing over and over again. For an example, see Loops.
See also
Basic elements