load_ascii

版本 1.2.0.0 (2.1 KB) 作者: Jacob
Quickly load offset data from ascii file
510.0 次下载
更新时间 2013/9/3

查看许可证

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.
%syntax
%[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.

引用格式

Jacob (2024). load_ascii (https://www.mathworks.com/matlabcentral/fileexchange/40189-load_ascii), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2011b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Low-Level File I/O 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.2.0.0

updated comments in code. made description more accurate.

1.1.0.0

Fixed typo in description.

1.0.0.0