Using structfun with wcoherence function

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개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2021년 6월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by