struct2cell malfunctioning
David Bateman
David.Bateman at motorola.com
Tue Jul 1 03:32:38 CDT 2008
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.
More information about the Bug-octave
mailing list