MATLAB: Ranksum – Wilcoxon rank sum test – Get more statistics using a for loop

for loopmann withney testranksumtestwilcoxon rank sum test

Hello everyone!
I am running some statistics and I need to use the Wilcoxon rank sum test.
I have 2 matrices and I need to compare 25 vector pairs.
If I run the test in a for loop, I get only the p-values – I would love to get more statistics but I have not been able to find a way.
That is what I have now:
Matrix1 = n x 25
Matrix2 = m x 25
for i = 1:25
testresults(i) = ranksum(Matrix1.(i),Matrix2(i),'method','exact')
end
If I run the test like this, I will get as a results just the pval, any clue how to get [p,h,stats] in a for loop?
I know how to run this out of the for loop.
Thank you all in advance for your help!

Best Answer

p = nan(1,n);
h = false(1,n);
stats = cell(1,n);
for i = 1:n
[p(i),h(i),stats{i}] = ranksum(x,y,__)
end