View License

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

» Watch video

Highlights from

4.0 | 1 rating Rate this file 7 Downloads (last 30 days) File Size: 2.06 KB File ID: #40189 Version: 1.2



Jacob (view profile)


05 Feb 2013 (Updated )

Quickly load offset data from ascii file

| Watch this File

File Information

This function loads data from a tab delimited or csv ascii file similar to dlmread/importdata. If the file has fixed width columns and an offset is desired, it uses this information to quickly scan to desired area (making it significantly faster in those scenarios). Useful when working with very large ascii files that cannot be entirely loaded into memory at one time. If a file is loaded in with no offset, load_ascii is comparable to dlmread (faster/slower depends on delimiter). Importdata is many times slower than both.

Example usage:
Consider scenario where we have a very large ascii file (fixed width tab delimited, 24 header lines). We are only interested in a section of 2e6 lines, 20e6 past the end of the header.
%[data,headerText] = load_ascii(filename,delimiter,header,nlines,offset)
tic;data = load_ascii(filename,'\t',24,2e6,20e6);toc;
tic;data2 = dlmread(filename,'\t',[20e6+24 0 12e6+23 2]);toc;
Elapsed time is 3.838641 seconds.
Elapsed time is 21.537717 seconds.

Required Products MATLAB
MATLAB release MATLAB 7.13 (R2011b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
17 Jun 2013 Pramod Kulkarni

11 Feb 2013 1.1

Fixed typo in description.

03 Sep 2013 1.2

updated comments in code. made description more accurate.

Contact us