Beta version of STRUCT2XLS Save 1D data + fieldnames from matlab struct into xls file STRUCT2XLS(filename,struct) converts a matlab struct with 1D numerical fields !! to an excel file. Non-numeric arrays are only allowed with xlswrite in matlab 2006b and above. Character arrays can be 2D. By default the 2nd dimension of all 1D arrays should be equal, and are taken as the column length in the excel sheet. Example of resulting *.xls file: +---------------+---------------+---------------+---------------+ |# textline 1 | | | | |# textline 2 | | | | |# textline 3 | | | | | columnname_01 | columnname_02 | columnname_03 | columnname_04 | | units | units | units | units | | number/string | number/string | number/string | number/string | | number/string | number/string | number/string | number/string | | number/string | number/string | number/string | number/string | | ... | ... | ... | ... | | number/string | number/string | number/string | number/string | +---------------+---------------+---------------+---------------+ * Requires xlswrite from matlab 2006b depends upon Excel as a COM server. - Does not use xlswrite from file exchange, which uses ActiveX. which due to bug in xlswrite files while writing to other directories, the xlsfile is created locally with a tmp file and and then copied to the destination directory. So you need write access where you run struct2xls. * Beta version. * Is not (by default) reciprocal of xls2struct (due to units line below column headers) and cell aray for 2D char arrays STRUCT2XLS(filename,struct,<keyword,value>) where implemented key words are: * units - 0 = not, - 1 = empty line - cell array is yes - struct with a fieldnames matching the struct field names is yes * coldimnum dim ension of fieldname input arrays to be used as column in excel (1 or 2) (default 2) after option oneD has optionally reshaped so the 1st dimension is 1. * coldimchar dim ension of fieldname input arrays to be used as column in excel (1 or 2) (default 2) after option oneD has optionally reshaped so the 1st dimension is 1. * oneD makes sure that both numeric matrix columns and matrix rows are written as Excel columns (default 1), only works for arrays where either 1st or 2nd dimension has lenght 1.. * header cell array of comment lines above column names (see also keyword commentchar) * overwrite which can be 'o' = overwrite (1) 'c' = cancel 'p' = prompt (default, after which o/a/c can be chosen) (0) * commentchar character to append to start of comment (header) line (default '#') [success] = STRUCT2XLS(...) [success,M] = STRUCT2XLS(...) where M is the cell array passed to XLSWRITE. See also: XLS2STRUCT, XLSDATE2DATENUM, XLSREAD, XLSWRITE (2006b, otherwise mathsworks downloadcentral)