Path: Common/General
% Convert a structure into a cell array. Where columns of the array include both values and fieldnames. For example, the struct x.a = 1 x.b.c = 2; x.b.d = 3; Becomes a 1 b c 2 b d 3 The companion array m is 1 0 1 1 1 0 1 1 0 Where a 1 indicates that the cell is a field name. This function contains a recursive call. Therefore the depth of the structure must be less than the number of recursions. The struct may have one dimensional cells as elements. -------------------------------------------------------------------------- Form: [y, m] = StructToCell2D( x ) -------------------------------------------------------------------------- ------ Inputs ------ x (1,1) Structure ------- Outputs ------- y (:) Cell Array m (:) Index matrix 1 = field, 0 = data --------------------------------------------------------------------------
Back to the Common Module page