txt2struct.m

Version 1.0.0.0 (6.7 KB) by Tim
read a text file and store in a matlab structure.
269 Downloads
Updated 16 Jun 2014

View License

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
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0