Mostrar comentarios más antiguos
Hello,
I am using this cancer dataset. I have 569 samples( rows) and 30 attributes ( 3:30 columns). The second colunms indicates the type of tumor ( 'M' = malignant, 'B' = benign). I want to order first the M samples , then the B samples. How can I do it on matlab?

I would appreciate your response.
P.S. : It's not a homework or an exam
%% Load data
%filename='wdbc.data';
%url=['https://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+(Diagnostic)/' filename];
%file_destination = filename;
%websave(file_destination,url);
%Data = readtable(file_destination, 'FileType','text', 'Delimiter', 'comma');
VarNames = {'ID','B/M','mean radius', 'mean texture', 'mean perimeter', ...
'mean area', 'mean smoothness', 'mean compactness', 'mean concavity', ...
'mean concave points', 'mean symmetry', 'mean fractal dimension', ...
'radius error', 'texture error', 'perimeter error', 'area error', ...
'smoothness error', 'compactness error', 'concavity error', ...
'concave points error', 'symmetry error', ...
'fractal dimension error', 'worst radius', 'worst texture', ...
'worst perimeter', 'worst area', 'worst smoothness', ...
'worst compactness', 'worst concavity', 'worst concave points', ...
'worst symmetry', 'worst fractal dimension'};
Data.Properties.VariableNames = VarNames;
Data_30 = Data(:,3:32); % remove column 1 and 2
Data_ar = table2array(Data_30); % transform from table to array
1 comentario
Walter Roberson
el 2 de En. de 2023
[~, idx] = sort(T{:, 2}, 'descend');
newT = T(idx, :) ;
for table T
Respuestas (1)
Data = table(randi(1E4,6,1),['M';'B';'M';'M';'B';'B'], rand(6,1), randn(6,1), randi(9,6,1))
Data = sortrows(Data,2, 'descend')
.
Categorías
Más información sobre Fractals en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!