read text file into matlab

53 Ansichten (letzte 30 Tage)
Pradeep Sanjeewa
Pradeep Sanjeewa am 27 Jan. 2015
Kommentiert: Pradeep Sanjeewa am 27 Jan. 2015
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

Akzeptierte Antwort

Hikaru
Hikaru am 27 Jan. 2015
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 Kommentare
Pradeep Sanjeewa
Pradeep Sanjeewa am 27 Jan. 2015
Thanks a lot. it worked.
Pradeep Sanjeewa
Pradeep Sanjeewa am 27 Jan. 2015
How can I get three different data matrices according to the three different classes : Iris-setosa, Iris-versicolor, Iris-virginica ?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Import and Export finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by