Indexing One Column from 4D Array?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I'm trying to create a correlation coefficient between two variables of 716 elements. One of the variables (func) is a 84 x 84 x 52 x 716 array and I want to take the 716 elements from it. The other variable (seedts) is already formatted as 716x1.
When I run this code, I get an error using corrcoef that X and Y must have the same number of elements.
fcmap=zeros(1,84);
fcmap=fcmap.';
for pix = 1:size(fcmap,2)
tmp=corrcoef(seedts,func)
pixr=tmp(1:2);
fcmap2(pix)=pixr
if doFisherZ
fcmap(pix)=(.5*long((1+pixr)/(1-pixr)));
else
end
end
Any suggestions for how to do this? Thanks!
1 Kommentar
Luca Ferro
am 22 Mär. 2023
i don't quite undersand the request.
''I want to take the 716 elements from it'' confuses me. Since you have a 4d matrix every single combination of values will have 716 elements.
This works, but it consider the 716 elements of only one combination.
corrcoef(seedts,func(1,1,1,1:end))
meaning that this one works as well:
corrcoef(seedts,func(1,1,2,1:end))
and so all the combination in the dimensions 84x84x52.
Do you want to loop through all of them or are you interested in one specific?
Antworten (1)
Cris LaPierre
am 22 Mär. 2023
one of the variables has 262708992 elements while the other has 716. You haven't specified which row, column, and page you want to extract the 'column' of 716 values from, but it might look something like this.
tmp=corrcoef(seedts,func(pix,pix,1,:));
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!