Error using corrcoef. x and y must have the same number of elements....?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone!
Running some fMRI stuff and we are having some trouble trying to figure out what Error using corrcoef X and Y must be have the same number of elements
for r=1:roiN
fcmap=zeros(1,numpix); %1-by-#num voxels in 3D volume
seedts=load([roiList{r},'_','residvol_ts.txt']);
for pix=1:size(fcmap,2) %1 to #num voxels in 3D volume
tmp=corrcoef(seedts,func(:,pix)); %calc correlation bewteen seed timeseries and timeseries of that voxel; tmp=2x2 symmetric corr table
pixr=tmp(1,2);
fcmap(pix)=pixr; %fill voxel with correlation coefficient
if doFisherZ
fcmap(pix)=(.5*log((1+pixr)/(1-pixr)));
else
end
end
Thanks for your help :)
1 comentario
Mathieu NOE
el 28 de Feb. de 2023
yeap
read the doc
% this work
A = randn(10,1);
B = randn(10,1);
R = corrcoef(A,B)
% this doesn't work
A = randn(10,1);
B = randn(12,1);
R = corrcoef(A,B)
Respuestas (1)
Dinesh
el 27 de Mzo. de 2023
Hi Ryu!
Here in this line of code
tmp=corrcoef(seedts,func(:,pix));
The time series seed array and time series voxel are not having same number of elements and without same number of elements we cannot calculate correlation coefficent. Despite how they are shaped to calculate corrcoeff we need to have same number of elements.
For more Details on how correlation coefficient is calculated and it's internal mathematics please refer the following MATLAB Documentation
0 comentarios
Ver también
Categorías
Más información sobre Time Series en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!