:I. 0 2 0 3 0 :I. :I. 2 2 3 3 1.E 4. 4
1.E 0 5 0 4 I1 9 :.3 6 4) '7 '7 t3 t3
A,C:L3 b
h
11 22 33 44
40 50 60 55 66 77 88
10 20 30
B1112233411 55 66 77 88
A scalar can also be catenated to an array. In the following example, a scalar is
catenated to a matrix. Notice that the scalar is repeated to complete the coordinate:
A+:? 3 P 1. 0 2 0 3 0 4.0 5 0 6 [I
A
10 20 30
'4.0 50 60
10 20 30 99
40 50 60 9{?
10 20 30
1.E 0 5 0 6 0
YP 9Y 99
A, C239Y
AtCl.399
A vector can also be catenated to another array, provided the length of the vector
matches the length of the coordinate not specified. See the following examples:
A,99 88
J.0 20 30 9'?
'+0 50 60 08
A,ci:l99 88
A,C:iI 99 88
LENGTH ERROR -
A
The catenate function is useful when creating lists of information. Sometimes it is
necessary to use an empty array to start a list. For example, suppose you want to
create a matrix named PHONE where each row will represent a 7-digit telephone
number. First you want to establish the matrix, then add the telephone numbers
at a later time. The following instruction will establish an empty array named
PHONE with no (0) rows and seven columns:
1' t1(:) N I: 4- 0 "7 6' i I!
I' li 13 N Ei:
Blank display indicates an
empty array.
.+
p Pt4(3N1,
0 '7
Now, the telephone numbers can be added as follows:
INDEXING
You may not want to refer to the whole array but just to certain elements. Referring
to only certain elements is called indexing. Index numbers must be integers; they
are enclosed in brackets and written after the name of the variable to which they
apply. Assume that A is assigned a vector as follows: At 1 .I 1.2 1.3 1.4 1.5 1.6 1.7.
The result of entering A is the whole vector, and the result of entering A[21 is 1.2
(assuming the index origin is 1; see Chapter 5 for more information on the index
origin).
I
Here are some more examples of indexing:
At.. 1. J. J.2 :I. 3 1 1.1. 1.5 1. b 17
AC31
h I:: 5 3 7 1. :I
r3t-3 :I. 4 b
ACB1
3.
;3
1.5 13 1 '7 1 :I.
A Blank Character
I
39
Previous Page Next Page