This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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');
This table outlines which function to use for different file types. For more information, see Extract Text Data from Files.

Text, Microsoft® Word, PDF, and HTML filesextractFileTextstr = extractFileText('sonnets.txt');
CSV and Microsoft Excel® filesreadtabletbl = readtable('weatherReports.csv','TextType','string');
HTML codeextractHTMLTextstr = extractHTMLText('<html><body><h1>THE SONNETS</h1><p>by William Shakespeare</p></body></html>');
PDF formsreadPDFFormDatadata = readPDFFormData('weatherReportForm1.pdf');

See Also

| | |

Related Topics