|
Chapter Contents |
Previous |
Next |
| Understanding the Language |
Matrix literals with multiple elements have the elements enclosed in braces. Use commas to separate the rows of a matrix. For example, the statement
x={1 2 3 4 5 6};
assigns a row vector to the matrix X:
X
1 2 3 4 5 6
The statement
y={1,2,3,4,5};
assigns a column vector to the matrix Y:
Y
1
2
3
4
5
The statement
z={1 2, 3 4, 5 6};
assigns a 3 ×2 matrix literal to the matrix Z:
Z
1 2
3 4
5 6
The following assignment
w=3#z;creates a matrix W that is three times the matrix Z:
W
3 6
9 12
15 18
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.