MATLAB reads the. Data File in UCI

Source: Internet
Author: User

Method 1:

Open Excel first Data in the above column -- import external data -- "file type" ("all data") in the dialog box ")
Change to "all files" -- select your ***. data File -- open -- next -- select "comma" in "separator" -- "next --" complete -- "create worksheet --" OK -- "save the file and do not forget in English !!!!
Drag the Excel file to the workspace in MATLAB.

Method 2:

Read data from the UCI dataset Iris. Data:

> [Attrib1, attrib2, attrib3, attrib4, Class] = textread ('data \ Iris. data ',' % F % s', 'delimiter ',',');

> Attrib = [attrib1 '; attrib2'; attrib3 '; attrib4'] ';

> A = zeros (150, 1 );

> A (strcmp (class, 'iris-setosa ') = 1;

> A (strcmp (class, 'iris-versicolor') = 2;

> A (strcmp (class, 'iris-virginica ') = 3;

At this point, all attribute values are saved to attrib, and category values are saved to array.



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.