How to do a ttest2 between two 4D matrices?

1 次查看(过去 30 天)
I have two 4D matrices that I would like to do a ttest2 between to determine their relation at each point. The problem is that ttest2 only does the first element of the matrices, so I end up with a new matrix of dimension 1x128x17x12 from 64x128x17x12.
I have tried doing a for loop through:
for q=1:64
A(q,:,:,:)=ttest2(B,C);
end
However this just repeats the ttest for (1,:,:,:) for all 64 loops. I have tried putting the loop in each of B and C and even tried a nested loop but I end up getting the same problems.
Is there anyway I can get the full 4D matrix for each point from ttest2?

采纳的回答

Matt J
Matt J 2018-4-20
编辑:Matt J 2018-4-20

I have tried doing a for loop through... for q=1:64

Meaning you want 64 t-test results? If so, then you could do as follows

A = ttest2(B(:,:).', C(:,:).')
  2 个评论
HA
HA 2018-4-20
not quite, I would like a final matrix output of 64x128x17x12, that way I can tell which parts of the two are similar, and therefore plot only the significant results? Is there anyway to do this with ttest2?
Thank you for your reply, it may well be that I am using the wrong statistical test for what I want to do perhaps?
Matt J
Matt J 2018-4-20
编辑:Matt J 2018-4-20
But what are the dimensions of B and C? Which dimension corresponds to the different samples/observations on which each individual test result will be based?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by