No License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Convert Struct to Cell Array With Column Headers

Be the first to rate this file! 3 Downloads (last 30 days) File Size: 1.07 KB File ID: #10564 Version: 1.0

Convert Struct to Cell Array With Column Headers



29 Mar 2006 (Updated )

Converts a populated struct into a cell array with field names as column headers

| Watch this File

File Information

Accepts a 1-dimensional struct array (in the format 1xn) and converts it into a cell array. The first row of the cell array has the struct's field names in each column; the data from each of those fields for each entry in the struct array appears in subsequent rows. The idea is to make it easy to prep data for writing to an Excel spreadsheet using xlswrite.

weather =

1x3 struct array with fields:

>> wxcell = structToCellArrayWithHeaders ( weather )

wxcell =

    'temp' 'rainfall'
    [ 68] [ 0.2000]
    [ 80] [ 0.4000]
    [ 72] [ 0]

MATLAB release MATLAB 7.2 (R2006a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.

Contact us