Modified from Francisco de Castro's code, struc2xls lets you save data structures containing a mix of numeric and non-numeric data to an Excel file. This version runs faster than the original and has several extra output options.
STRUC2XLS (FILE,S) writes the data structure S to an Excel workbook named FILE in the current directory. Data fields can be numeric, non-numeric, or mixed. Output can be oriented vertically (field names in first column, data in rows) or horizontally (field names in first row, data in columns). I'm sure there's room for improvement here. Let me know...
Create a sample structure 's' with two fields:
Basic output to file 'demo.xls' in current directory:
Output beginning in cell D4 of Excel file:
Output to specified worksheet 'Students':
Output horizontal data (header row, data in columns):
Output to alternate directory
Jeff Evans (2022). struc2xls (https://www.mathworks.com/matlabcentral/fileexchange/22510-struc2xls), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: struc2xls
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!