Importing mat files with the load function everyone will. But today I get a data that the file suffix is '. Data '. How should I read it?
I only use the Matlab interface workspace the region's "Import data" button to manually import the file. Well, fortunately, it succeeded. By the way, this "Import data" button is very powerful, and even Excel files can be imported.
But how do you suppose to import such a non-mat file in a script?
This is the "ImportData" Function!
---------------------------------------------------------------------
ImportData
Load data from File
Syntax
ImportData (filename)
A = importdata (filename)
A = importdata (filename, delimiter)
A = importdata (filename, delimiter, nheaderlines)
[A, delimiter] = ImportData (...)
[A, delimiter, nheaderlines] = ImportData (...)
[...] = ImportData ('-pastespecial ', ...)
Description
ImportData (filename) loads data from filename to the workspace.
A = importdata (filename) loads data into A.
A = importdata (filename, delimiter) interprets delimiter as the column separator in ASCII file filename.
A = importdata (filename, delimiter, nheaderlines) loads data from the ASCII file filename, reading numeric data starting from Line nheaderlines+1.
[A, delimiter] = ImportData (...) returns the detected delimiter character for the input ASCII file.
[A, delimiter, nheaderlines] = ImportData (...) returns the detected number of the header lines in the input ASCII file.
[...] = ImportData ('-pastespecial ', ...) loads data from the system Clipboard rather than from a file.
----------------------------------------------------------------
The file formats that this function can support are: Mat file, ASCII files and spreadsheets,images, Audio files
This ASCII files and spreadsheets refers to: for ASCII files, data contains a double array. Other fields contain cell arrays.
For spreadsheets, each field contains a struct, with one field for each worksheet.
Import data in MATLAB: ImportData function