getmatrix4D#
Purpose#
Gets a contiguous matrix from a 4-dimensional array.
Format#
- y = getmatrix4D(a, i1, i2)#
- Parameters:
a (4-dimensional array) – Data.
i1 (scalar) – index into the slowest moving dimension of the array.
i2 (scalar) – index into the second slowest moving dimension of the array.
- Returns:
y (KxL matrix) – where L is the size of the fastest moving dimension of the array and K is the size of the second fastest moving dimension.
Examples#
// Create a column vector 1, 2, 3...120
a = seqa(1, 1, 120);
/*
** Reshape the column vector into a 2x3x4x5 dimensional
** array
*/
a = areshape(a, 2|3|4|5);
// Extract a submatrix
y = getmatrix4D(a, 2, 3);
After the code above:
101 102 103 104 105
y = 106 107 108 109 110
111 112 113 114 115
116 117 118 119 120
Remarks#
getmatrix4D()
returns the contiguous matrix that begins at the \([i1, i2, 1, 1]\)
position in array a and ends at the \([i1, i2, K, L]\) position.
A call to getmatrix4D()
is faster than using the more general getmatrix()
function to get a matrix from a 4-dimensional array, especially when i1
and i2 are the counters from nested for loops.
See also
Functions getmatrix()
, getscalar4D()
, getarray()