Navigation

Operators and Keywords

Function List:

C++ API

: c = struct2cell (s)

Create a new cell array from the objects stored in the struct object.

If f is the number of fields in the structure, the resulting cell array will have a dimension vector corresponding to [f size(s)]. For example:

s = struct ("name", {"Peter", "Hannah", "Robert"},
          "age", {23, 16, 3});
c = struct2cell (s)
  ⇒ c = {2x1x3 Cell Array}
c(1,1,:)(:)
  ⇒
     {
       [1,1] = Peter
       [2,1] = Hannah
       [3,1] = Robert
     }
c(2,1,:)(:)
  ⇒
     {
       [1,1] = 23
       [2,1] = 16
       [3,1] = 3
     }

See also: cell2struct, fieldnames.

Package: octave