Version (2.31 KB) by Ben Mitch
Provides a one-call interface to read/write flat text files or line-based text files.


Updated 22 Nov 2010

View License

This convenience function provides one-call read/write access to a flat text or line-based text file using calls of the following form.

content = textfile(filename);
textfile(filename, content);

The content can be returned as a char array, or a cell array of lines in the file. Some additional options are provided (see help).

Cite As

Ben Mitch (2023). textfile (https://www.mathworks.com/matlabcentral/fileexchange/29477-textfile), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Migrate GUIDE Apps in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

Linux implementation was broken, now is fixed.