Read delimited text file directly into a matlab structure with fields based on the header line text. Datatype for each field is determined by analyzing the first line of data. If datatype of a field changes then data for entire column is stored in a cell.
Enable quick input of data and easy access via the matlab structure.
[output_structure] = txt2struct(textfile, varargin)
example
mystruct = txt2struct('testdata.csv');
% Author:
% Tim Ryan CSIRO 18 Dec 2007
% Revised:
% Gordon Keith CSIRO 12 Sep 2013
Cite As
Tim (2024). txt2struct.m (https://www.mathworks.com/matlabcentral/fileexchange/46971-txt2struct-m), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |