The setup of the (AFAIU) relevant statements goes as follows:
:
int band_count = poDS->GetRasterCount(); // call a GDAL library function
:
Cell m_band(band_count); // declare m_band to be a cell array
:
for (int curr_band = 0; curr_band < band_count; curr_band++) {
:
< generate struct with raster info for current band >
< finally resulting in a struct (octave_scalar_map) band_struct >
:
m_band(curr_band) = band_struct; // crash if curr_band > 0
:
I'm afraid something went wrong with the generation of band_struct. Could you not post this part of code?