Navigation

Operators and Keywords

Function List:

C++ API

: cell2struct (cell, fields)
: cell2struct (cell, fields, dim)

Convert cell to a structure.

The number of fields in fields must match the number of elements in cell along dimension dim, that is numel (fields) == size (cell, dim). If dim is omitted, a value of 1 is assumed.

A = cell2struct ({"Peter", "Hannah", "Robert";
                  185, 170, 168},
                {"Name","Height"}, 1);
A(1)
  ⇒
     {
       Name   = Peter
       Height = 185
     }

See also: struct2cell, cell2mat, struct.

Package: octave