read text file into matlab

53 ビュー (過去 30 日間)
Pradeep Sanjeewa
Pradeep Sanjeewa 2015 年 1 月 27 日
コメント済み: Pradeep Sanjeewa 2015 年 1 月 27 日
https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data
How can we read that kind of data set into matlab? I want just the numerical values. May be to a 4x200 matrix

採用された回答

Hikaru
Hikaru 2015 年 1 月 27 日
Use textscan.
FID = fopen('iris.txt')
C_data0 = textscan(FID,'%f %f %f %f %s', 200, 'Delimiter',',')
numericVector = cell2mat(C_data0(:,1:4)) %ignores the last column of strings
  2 件のコメント
Pradeep Sanjeewa
Pradeep Sanjeewa 2015 年 1 月 27 日
Thanks a lot. it worked.
Pradeep Sanjeewa
Pradeep Sanjeewa 2015 年 1 月 27 日
How can I get three different data matrices according to the three different classes : Iris-setosa, Iris-versicolor, Iris-virginica ?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by