index in a reshaped matrix
Show older comments
I'm quite new to matlab. So far, I've managed my way with help and forum, but now I got stuck.
I'm trying to correlate a matrix R [114 x 1] with a matrix P [114 x 22 x 13 x 71]. I've tried both 1) cor = zeros(22 x 13 x 71); p = zeros(22 x 13 x 71); [cor,pval] = corr(R, P)
or simply 2) [cor,pval] = corr(R,P) % without first creating an empty matrix
In both cases, I get size(cor) = 20306 which I then reshape into my original P (22x13x71).
My first question is whether I can assume, as I've done now, that the correlation + reshaping will keep the exact order I had in my original matrix P. The second question, which is the one I'm struggling with, is how to get the right indexes. I'm trying to find where pval < .05 x = find(pval < .05) but that gives me indexes which I don't know how to refer back to (22x13x71). So in other words, it does not suffice to know the indexes. I need to know where the indexes fall in P.
I think this is a very simple question but I've already tried everything I know. Thanx a lot
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!