How to define a set of features of a dataset in matlab?
2 次查看(过去 30 天)
显示 更早的评论
I have a dataset CNS with the size nxm n instances and m features(columns), I wanted to write codes to collect all the features of the data in a set or maybe in a vector (F):
F=F1,F2,F3,....,Fm
and then I want to say that the set E is equal to the set F, It means all the elements in F will be put in the set E to use E in the next step, and also I want to say that S is an empty set initially, then I used two for loops to compute the distance between each columns of the data and calculated the average of thses values,
and I used min function to obtain the index of the minimum then I removed It from F and put the result in E.
clc;
clear;
close all;
tic
load CNS.mat
data=CNS;
[n,m]=size(data);
for c=1:m
F(:,c)=data(:,c);
end
E=F;
S=[];
for g=1:m-1
for h=g+1:m-1
t(g,h)=fDiceaDist(data(:,g),data(:,h));
b=sum(t)/(m-1);
end
end
[mn,indexn]=min(b);
E=setdiff(F,indexn);
I attach the CNS, fDiceaDist function.
by continueing the program, when I run the codes, It never stops.
I'll be vary grateful to have your opinions If these codes are true in matlab. Thank you very much
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!