mb_set_array_element |
![]() ![]() |
bool_t mb_set_array_element( LPARRAY pArr, LPIXARRAY ix_array, mb_value_t val )
Sets an array element with the specified mb_value_t value.
Example
///////////////////////////////////////////////////////////////////////////// // Copy last dimension from one array to another // void CopyLastDim( LPARRAY pOut, LPARRAY pIn ) { int ix_array_in[4]; int ix_array_out[4];
mb_get_array_dimensions( pIn, ix_array_in ); mb_get_array_dimensions( pOut, ix_array_Out );
// Make sure they're the same if ( ix_array_in[0] == ix_array_out[0] ) { int nCount = ix_array_in[0];
// Clear the in and out ix arrays memset( ix_array_in, 0, sizeof( ix_array_in ) ); memset( ix_array_out, 0, sizeof( ix_array_out ) );
// Copy the entire last dimension, element by element for ( int i = 0; i < nCount; i++ ) { mb_value_t val;
ix_array_in[0] = i;
if ( mb_get_array_element( pIn, ix_array_in, &val ) ) { ix_array_out[0] = ix_array_in[0];
mb_set_array_element( pOut, ix_array_out, val ); } endif } endfor } endif } endfunc
|