Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Need help on creating loop

1 vue (au cours des 30 derniers jours)
Jack Sparrow
Jack Sparrow le 9 Mai 2013
Clôturé : MATLAB Answer Bot le 20 Août 2021
Please I need assistance on this code, I am trying to matching two data. The first one is the training set, while the second one is the test set. They both contain 1 x 20 row vector each. Each cell in the vector is the value of an object length. Now I want to match the two data, such that the result is 19 x 20, instead of 20 x 20. Because test data number 1 should be match against all but itself and the same thing for the rest of the data. The computation is just the normal cumulative distribution function with mean 0 and standard deviation 1.
numtrainW = length(Wtrain);
numtestW = length(Wtest);
wscore = [];
for b=1:numtestW;
for d=1:numtrainW;
c_w = var(Wtrain);
Zw = abs(Wtrain(d)-Wtest(b,:))/c_w;
p_w = cdf('Normal',Zw,0,1);
Sw = 2*(1-p_w);
wscore = [wscore; Sw];
end
end
Thank you.

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by