Difference between revisions of "Multidimensional array"
(Created page with "Category: Arrays Multidimensional arrays are arrays with two or more than dimensions. Because papers and computer screens are 2-dimensional, arrays with higher...") |
|||
Line 3: | Line 3: | ||
[[Multidimensional array]]s are [[array]]s with two or more than dimensions. | [[Multidimensional array]]s are [[array]]s with two or more than dimensions. | ||
− | Because papers and computer screens are 2-dimensional, arrays with higher number of dimensions are hard to | + | Because papers and computer screens are 2-dimensional, arrays with higher number of dimensions are hard to visualize. The following 3-dimensional array <code>A</code> indexed by three indexes, <code>Index_a</code>, <code>Index_b</code> and <code>Index_c</code>, serves as an example of a simple multi-dimensional array: |
:<code>Variable A :=</code> | :<code>Variable A :=</code> |
Revision as of 20:14, 22 August 2016
Multidimensional arrays are arrays with two or more than dimensions.
Because papers and computer screens are 2-dimensional, arrays with higher number of dimensions are hard to visualize. The following 3-dimensional array A
indexed by three indexes, Index_a
, Index_b
and Index_c
, serves as an example of a simple multi-dimensional array:
Variable A :=
Index_c = 'displayed value'
Index_b ▶ Index_a ▼ a b c x value value value y value value value z value value value
As another example of a 3D array, consider the array Colors
indexed by Number
, Letter
, and Hue
:
Variable Colors :=
Number ▶ Letter ▼ 1 2 3 A 45 19 92 B 13 21 81 C 12 43 47 Hue = 'Red'
Number ▶ Letter ▼ 1 2 3 A 34 25 45 B 11 62 19 C 84 45 53 Hue = 'Green'
Number ▶ Letter ▼ 1 2 3 A 21 65 95 B 48 33 12 C 57 56 23 Hue = 'Blue'
Compare these multi-dimensional arrays to the following arrays with fewer dimensions:
An index or list and its values:
Index N :=
1 2 3 4 5
A one-dimensional array:
Variable Squares :=
Squares ▶ 1 2 3 4 5 1 4 9 16 25
A two-dimensional array:
Index_b ▶ Index_a ▼ a b c x value value value y value value value z value value value
See Also
Comments
Enable comment auto-refresher