File Exchange

image thumbnail


version 1.0 (6.7 KB) by

read a text file and store in a matlab structure.



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)


mystruct = txt2struct('testdata.csv');

% Author:
% Tim Ryan CSIRO 18 Dec 2007
% Revised:
% Gordon Keith CSIRO 12 Sep 2013

Comments and Ratings (0)

MATLAB Release
MATLAB 8.1 (R2013a)

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

» Watch video