Display results from t-test after loop
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a loop running through participants 1-10 in which (among other thigns) two t-tests are conducted for each participant. I would like to have the results for each participant to be displayed in the end after the loop is done, ideally in a table but I don't know if that is at all possible, but it would be alright to just have the two p-values for each participant displayed. I tried to create a structure which looks like this but I get the error message "Subscript indices must either be real positive integers or logicals". How can I fix this?
for subject = 1:10
for phase = 1:3
[h, p, ci, stats] = ttest(CSplus_A, CSminus)
p_value_A.(sprintf('s%d_%d', subject, phase)) = p
[h, p, ci, stats] = ttest(CSplus_B, CSminus)
p_value_B.(sprintf('s%d_%d', subject, phase)) = p
end
end
0 Commenti
Risposte (1)
KSSV
il 16 Apr 2019
YOu can make them a matrix...why structure?
p_value_A = zeros(10,3) ;
p_value_B = zeros(10,3) ;
for subject = 1:10
for phase = 1:3
[h, p, ci, stats] = ttest(CSplus_A, CSminus)
p_value_A(subject, phase) = p ;
[h, p, ci, stats] = ttest(CSplus_B, CSminus)
p_value_B(subject, phase) = p ;
end
end
0 Commenti
Vedere anche
Categorie
Scopri di più su Mathematics and Optimization in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!