Import Text Data into MATLAB
Use the following functions to import text data into MATLAB®. Usually, the easiest way to import text data into MATLAB is to use the extractFileText
function. For example, to import text from a text file,
use:
str = extractFileText('sonnets.txt');
Source | Function | Example |
---|---|---|
Text, Microsoft® Word, PDF, and HTML files | extractFileText | str = extractFileText('sonnets.txt'); |
CSV and Microsoft Excel® files | readtable | tbl =
readtable('factoryReports.csv','TextType','string'); |
HTML code | extractHTMLText | str = extractHTMLText('<html><body><h1>THE
SONNETS</h1><p>by William
Shakespeare</p></body></html>'); |
PDF forms | readPDFFormData | data =
readPDFFormData('weatherReportForm1.pdf'); |
See Also
extractFileText
| readtable
| extractHTMLText
| readPDFFormData