フィルターのクリア

Loop to 'kstest2' between each column

1 回表示 (過去 30 日間)
fr_sk
fr_sk 2016 年 5 月 27 日
回答済み: Arham Malik 2020 年 7 月 9 日
Hey, I'm stuck with a loop:
I want to test(kstest2) each column of a matrix for similarities with other columns (in order to cluster them eventually). The output of the test is a single value [0,1] for each comparison.
I tried the following approach but the results do not appear to be right, do you guys see where I've made a mistake?
for m = 1:300,
for n = 2:300
h(1,m) = kstest2(dataset(m,:), dataset(n,:)) ;
end
end
Is this the correct way to use a loop for operations between every column of a matrix?
Thanks a lot in advance!

回答 (1 件)

Arham Malik
Arham Malik 2020 年 7 月 9 日
for m = 1:k
for n = 1:k
[h(n,m), p(n,m)] = kstest2(pixelCountsarray(:,n),pixelCountsarray(:,m));
end
end
Should look something like this

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by