index in a reshaped matrix
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!