I have a database from UCI Machine Learning (Abalone Database)and I need to separate the first column, which is a character, from the other columns, which are double.
The second part I already have with this code:
abaloneData = csvread('abalone.data',0,1);
I tried a lot to gatter the first part to use on KNN, but I failed every time.
Thanks.
EDIT1:
read_data.m
function [features, labels] = read_data()
features = csvread('abalone.data',0,1);
fileID = fopen('abalone.data');
data = textscan(fileID,'%s %*[^\n]', 'Delimiter',',');
fclose(fileID);
labels = cell2mat(data{1});
end
knn.m
[features,labels] = read_data();
Mdl = fitcknn(features,labels);
textscan