Azzera filtri
Azzera filtri

read text file into matlab

10 visualizzazioni (ultimi 30 giorni)
Pradeep Sanjeewa
Pradeep Sanjeewa il 27 Gen 2015
Commentato: Pradeep Sanjeewa il 27 Gen 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

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Import and Export in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by