Using structfun with wcoherence function

2 次查看(过去 30 天)
I am attempting to calculate coherence for waveform data. There are a total of 44 channels. The usual way of processing is to go through a for loop (as shown below)
df = rand(8902,44); % create the array
fs = 5; % sample rate is 5Hz
[wcoh1,wcs1,f1,coi1] = wcoherence(df(:,1),df(:,2),fs);
In order to speed up the processing, I am trying to use structfun and gpuArray to run through all possible iterations. I have been able to calculate the mean using structfun but have been unable to use wcoherence. Below is my attempt
df = rand(8902,44); % create the array
df_gpu = gpuArray(df) % convert to GPU array
fs = 5; % sample rate is 5Hz
combinations = nchoosek(uint16([1:44]),uint16(2)); % gives me all the unique combinations of coherence
[wcoh1,wcs1,f1,coi1] = wcoherence(df_gpu(:,1),df_gpu(:,2),fs);
Does anyone have any recommendations on using combinations to index df_gpu and then compute the coherence?
Thanks for any insight.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Standard File Formats 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by