Material on Text Files
In the two videos described here, we show how you can read the content of external text files into MATLAB, and how you can write information from MATLAB to an external text file. Text files enable us to provide information for our programs in a form that is human readable and can contain both textual and numerical information. They also enable us to store the results of our programs in a permanent way and in a form that can be read by other applications.
Lecture Videos
The following links take you to the two videos
The video files are also stored in our shared folder on Google Drive. The two
video files are named filesRead.mp4
(523 MB)
and filesWrite.mp4
(409 MB).
Video Transcripts
The following pdf files provide transcripts of the two videos:
- Video #11: Reading External Text Files (pdf transcript)
- Video #12: Writing External Text Files (pdf transcript)
The video material is presented in a MATLAB Live Script, and you can also access a pdf of this Live Script here:
-
filesMLX.pdf
(pdf)
The above pdf files are also stored in the shared folder on Google Drive.
Code Files
Code for the examples in these videos, including the MATLAB Live Script,
filesMLX.mlx
, can be found in the download
folder in the cs112
course directory on the CS file server, in a folder named
files
(also stored in the shared Google folder). A link to a zip file
containing this code folder is also posted on the
course schedule page.