Import data in MATLAB: importdata Function

Source: Internet
Author: User

You can use the load function to import mat files. But today I get a data file with the suffix '. data '. How should I read it?

I had to use the "Import Data" button in the workspace area of the MATLAB interface to manually import the file. Well, it's okay. It's actually successful. By the way, this "import data" button is very powerful and can be imported into Excel files.

But how to import such non-mat files in the script?

At this time, the "importdata" function is coming!

---------------------------------------------------------------------

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 into the workspace.

A = importdata (filename) loads data into.

A = importdata (filename, delimiter) Interprets delimiter as the column Separator in ASCII file filename.

A = importdata (filename, delimiter, nheaderlines) loads data from 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 header lines in the input ASCII file.

[...] = Importdata ('-pastespecial',...) loads data from the system clipboard rather than from a file.

----------------------------------------------------------------

This function supports the following file formats: mat files, ASCII files, spreadsheets, images, and audio files.

This ASCII files and spreadsheets refer 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.