octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hpw to assign a struct to a cell array element in an .oct file


From: Kozma, Endre
Subject: Re: Hpw to assign a struct to a cell array element in an .oct file
Date: Sat, 19 Dec 2015 19:38:40 +0100

On Sat, 2015-12-19 at 07:55 -0800, PhilipNienhuis wrote:

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?
I suggest replacing the struct generation temporarily with something very simple thing like this

octave_scalar_map band_struct;
band_struct.assign("answer", 42);

and checking whether it crashes. I use a very similar code-structure as you do, except I assign my structs to an octave_value_list.
Note, there is a more appropriate type for index variables: octave_idx_type.
reply via email to

[Prev in Thread] Current Thread [Next in Thread]