struct2cell malfunctioning

David Bateman David.Bateman at motorola.com
Tue Jul 1 03:50:42 CDT 2008


David Bateman wrote:
> Klaus Betzler wrote:
>   
>> # octave-3.0.1 windows version
>>
>> # malfunction of struct2cell
>>
>> # struct2cell repeats a one-dimensional structure 'length' times
>>
>> # example: get a one-dimensional structure
>> pc = physical_constant ();
>> sizeof (pc)                     # ans =  22308
>>
>> # make a cell array of it
>> pc_ca = struct2cell (pc);
>> sizeof (pc_ca)                  # ans =  6848556
>> sizeof (pc) * length (pc)       # ans =  6848556
>>
>> # Best regards, Klaus
>> _______________________________________________
>> Bug-octave mailing list
>> Bug-octave at octave.org
>> https://www.cae.wisc.edu/mailman/listinfo/bug-octave
>>   
>>     
> Ok, I can confirm that this is a bug. Simpler test code is
>
> %!test
> %!  s(1).field1 = 1; s(1).field2 = 2; s(2).field1 = 3; s(2).field2 = 4;
> %!  c{1,1,1} = 1; c{2,1,1} = 2; c{1,1,2} = 3; c(2,1,2) = 4;
> %! assert (struct2cell(s), c);
>
> I'll check and see if I can find a fix.
>
> D.
>   
In fact its already fixed in the repository for both 3.0.x and 3.1.x. Check

http://velveeta.che.wisc.edu/cgi-bin/hgwebdir.cgi/octave/rev/af562a3999cb

This will be in the next release

D.



More information about the Bug-octave mailing list