Cannot compute rank correlations for complex inputs.

2 views (last 30 days)
I am estimating the pairwise spearman correlation co-efficients on the EEG signals. They are of large datasets and I use the following code to estimate these;
function [Spearman_Rho_results]=spearman_corr(data)
Channels=size(data,1);
for i=1:Channels
for j=1:Channels
one=data(i,:);
two=data(j,:);
Spearman_Rho=corr(one',two','type','s');
Spearman_Rho_results(i,j)=Spearman_Rho;
end
end
end
It works well for some datasets. However for a specific dataset, it gives the following eroor;
Error using corr (line 200)
Cannot compute rank correlations for complex inputs.
I am unable to get the reasoning behind why this error happens to only this specific dataset while the remaining ones works fine with.
Any help is really appreiciable.
Thanks
Kind regards,
  1 Comment
dpb
dpb on 23 May 2019
Well, we can't either without the dataset in question/how you (or something/somebody else) process input to get the data array data but clearly somehow that particular dataset has complex values...
The problem is in your dataset, not in corr so you've got to back up and find out what went on there.

Sign in to comment.

Answers (0)

Categories

Find more on EEG/MEG/ECoG 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!