Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Need help on creating loop

1 view (last 30 days)
Jack Sparrow
Jack Sparrow on 9 May 2013
Closed: MATLAB Answer Bot on 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.

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!