Matlad read csv file and euclidean distance
Afficher commentaires plus anciens
I have a csv file with a lot of data The csv file looks like this
12001,0.2,0.32,0.9,....
12002,0.22,0.3,0.5,...
...
I need all this data in a matrix to compute the euclidean distance
to read the csv file I am using dlmread I need the data in a Matrix without the first value of each line, my matrix should look like this
M=[0.2 0.32 0.9; 0.22 0.3 0.5]
How can I skip the first value in each line and get my data into a matrix?
Réponse acceptée
Plus de réponses (1)
Jan
le 5 Nov 2015
M = csvread(filename);
M2 = M(:, 2:end);
D = sqrt(sum(M2 .* M2, 2));
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!