3.14. Some Useful Commands of Structures and Cells

  1. cell2struct

    The command cell2struct is used to convert cell array to structure array. The syntax is as follows:

         sample_struct = cell2struct(sample, fields, dimen)
    

    where sample_struct is structure array,

    sample is cell array,

    fields are the fields of the structure and

    dimen is the dimensions of the cell array.

  2. num2cell

    The command num2cell converts numeric array into cell array. The syntax is as follows:

         c_array = num2cell(number)
    

    where c_array is cell array name and number is numeric array.

    Both arrays will be of the same size.

  3. struct2cell

    The command struct2cell is used to convert a structure array to cell array. The syntax is as follows:

         c_array = struct2cell(sample-struct)
    

    where c_array is cell array ...

Get MATLAB® and Its Applications in Engineering: [Based on MATLAB 7.5 (R2007b)] now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.