write_ascii

Version 1.3.0.0 (1.58 KB) by Jacob
simple and elegant matlab function to quickly write large matrices to an ascii file.
349 Downloads
Updated 3 Sep 2013

View License

Writes large matrices to an ascii file. Format is up to user. Function automatically appends to file. It is many times (10-20X) faster than dlmwrite and almost as fast as using a mex file. Uses sprintf and fwrite (opposed to fprintf).

Example usage:

M = rand(1e5,3)*1000;
tic;dlmwrite('test.txt',M,'delimiter','\t','precision','%9.3f');toc;
tic;write_ascii('test2.txt',M,'\t','%9.3f');toc;
Elapsed time is 7.446049 seconds.
Elapsed time is 0.513611 seconds.

Cite As

Jacob (2026). write_ascii (https://www.mathworks.com/matlabcentral/fileexchange/40157-write_ascii), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Low-Level File I/O in Help Center and MATLAB Answers
Version Published Release Notes
1.3.0.0

fixed code comments so help command works

1.2.0.0

added example usage in description

1.0.0.0