Matlad read csv file and euclidean distance

9 views (last 30 days)
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

Thorsten
Thorsten on 5 Nov 2015
X = csvread('yourfile.csv');
X(:,1) = []; % delete first column

More Answers (1)

Jan
Jan on 5 Nov 2015
M = csvread(filename);
M2 = M(:, 2:end);
D = sqrt(sum(M2 .* M2, 2));

Tags

Community Treasure Hunt

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

Start Hunting!