Matlad read csv file and euclidean distance
Show older comments
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?
Accepted Answer
More Answers (1)
Jan
on 5 Nov 2015
M = csvread(filename);
M2 = M(:, 2:end);
D = sqrt(sum(M2 .* M2, 2));
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!