View License

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

» Watch video

Highlights from

Be the first to rate this file! 5 Downloads (last 30 days) File Size: 6.7 KB File ID: #46971 Version: 1.0



Tim (view profile)


16 Jun 2014 (Updated )

read a text file and store in a matlab structure.

| Watch this File

File Information

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

Required Products MATLAB
MATLAB release MATLAB 8.1 (R2013a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.

Contact us