Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Need help on creating loop

1 Ansicht (letzte 30 Tage)
Jack Sparrow
Jack Sparrow am 9 Mai 2013
Geschlossen: MATLAB Answer Bot am 20 Aug. 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.

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by