loop処理で行った検定で得られた統計値に、番号を付けて1つのファイルにまとめる場合はどうすれば良いですか?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
例えば、任意のtable(DATA)における、2列目から12列目にあるデータに対し、それぞれの1行目から19行目、21行目から40行目を比較しようとした場合、
各比較で得られた統計値に番号をふったうえで、一つのmatファイルにまとめて整理したいです。
初歩的な質問ですみません。どうぞよろしくお願い致します。
for i=2:12
A=table2array(DATA(1:19,i));
B=table2array(DATA(20:40,i));
[p,h,stats] = ranksum(A, B,'alpha', 0.05, 'tail','both')
end
0 commentaires
Réponse acceptée
Musashi Ito
le 28 Déc 2019
Modifié(e) : Musashi Ito
le 28 Déc 2019
各比較で得られた統計値を配列として格納して mat ファイルに保存もできそうですが、いかがでしょうか。以下のようなコードになるかなと思います
% テーブルデータ DATA の 2 列目から 12 列目の数値データを数値配列 testData として抽出
testData = DATA{:,2:12};
% testData の行数(m),列数(n)を取得
[m,n] = size(testData);
for k=1:n
% testData から 1 行目から 19 行目の k 列を抽出
A = testData(1:19,k);
% testData から 21 行目から 40 行目の k 列を抽出
B = testData(21:40,k);
% 配列として結果を格納
[p(k),h(k),stats(k)] = ranksum(A, B,'alpha', 0.05, 'tail','both')
end
% ワークスペースの変数を myfile.mat に保存
save myfile
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!