MxGetBlock
- get rectangular block of items from matrix

Matrix functions
(AFL 4.10)


SYNTAX MxGetBlock( matrix, startrow, endrow, startcol, endcol, asArray = False )
RETURNS Matrix or Array
FUNCTION Retrieves items from rectangular submatrix (block) and returns either smaller matrix (when asArray is set to False) or "normal" AFL array (when asArray is set to True). If array has different number of bars, unused elements are filled with Null.
EXAMPLE z = Matrix( 2, 20, 0 );
// first row
z = MxSetBlock( z, 0, 0, 0, 19, Close );
// second row
z = MxSetBlock( z, 1, 1, 0, 19, RSI( 5 ) );
printf("Matrix z ");
printf( MxToString( z ) );

x = MxGetBlock( z, 0, 1, 0, 19, True );

printf("Items are now in regular array (data series): " );
for( i = 0; i < 20; i++ )
printf( NumToStr( x[ i ] ) + " " );

z = MxGetBlock( z, 0, 1, 0, 1 ); // retrieve upper 2x2 submatrix
printf("Upper submatrix z ");
printf( MxToString( z ) );
SEE ALSO Matrix() function , MxSetBlock() function

References:

The MxGetBlock function is used in the following formulas in AFL on-line library:

More information:

Updated on-line reference