View License

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

» Watch video

Highlights from
txt2struct.m

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

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

txt2struct.m

by

Tim (view profile)

 

16 Jun 2014 (Updated )

read a text file and store in a matlab structure.

| Watch this File

File Information
Description

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

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