<div dir="ltr"><div><div><div><div>Thank you Jan-Mathijs,<br></div><br>So abs(x) will give me absolute value of x. But how can I use it considering that my data is in spm/fieldtrip format?<br></div>This is my code for wpli. <br>
</div>'fd' stores WPLI values so values from -1 to 1 but taking abs(fd) doesn't work.<br></div>Also not sure how to use just matlab to compute pli in the same way as the code below. Any tips? <br><div><div><div>
<div><div><br>listfiles=ls('C:\Users\Lid\Documents\a_project\Controls\sources [40 80]\both_m1s\BceRdfspm8_*.mat');<br><br>for j=1:size(listfiles,1)<br>    <br>spmfilename=deblank(listfiles(j,:)); <br><br>D= spm_eeg_load(spmfilename);<br>
data = D.ftraw(0);<br>%<br>% megchan1 = 'lm1';<br>megchan2 = 'rm1';<br>emgchan = 'EEG061';<br><br>% meg1 = ft_selectdata(data, 'channel', megchan1, 'toilim', [1 3], 'avgoverrpt', 'no');<br>
% meg1.label{1} = 'LM1';<br>meg2 = ft_selectdata(data, 'channel', megchan2, 'toilim', [1 3], 'avgoverrpt', 'no');<br>meg2.label{1} = 'RM1';<br>emg = ft_selectdata(data, 'channel', emgchan, 'toilim', [1 3], 'avgoverrpt', 'no');<br>
emg.label{1} = 'EMG';<br><br>%emg.time = meg.time;<br><br>inp = ft_appenddata([],emg, meg2);<br>%<br>cfg            = [];<br>cfg.output     = 'powandcsd';<br>cfg.method     = 'mtmfft';<br>%cfg.taper      = 'hanning';<br>
cfg.foilim     = [5 100];<br>cfg.toi = [1 3];<br>cfg.tapsmofrq  = 7; % was 2.5<br>cfg.keeptrials = 'yes';<br>cfg.channel    =  {'EMG', 'RM1'};%'EMG';<br>cfg.channelcmb = {'RM1','EMG'}; %'EMG' 'RM1'; 'LM1' 'RM1' };<br>
freq           = ft_freqanalysis(cfg, inp);<br>%<br>cfg            = [];<br>cfg.method     = 'wpli';<br>cfg.channelcmb = {'RM1', 'EMG'};<br>fd              = ft_connectivityanalysis(cfg, freq);<br>
<br>%<br>cfg                  = [];<br>cfg.xparam           = 'freq';<br>cfg.zparam           = 'wplispctrm';<br>cfg.xlim             = [5 100];<br>cfg.ylim             = [-1 1];<br>cfg.channel          = 'EMG';<br>
cfg.refchannel    = 'RM1';<br>cfg.showlabels       = 'yes';<br>figure; ft_singleplotER(cfg,fd);<br>L = 120;<br>c95 = 1-0.05^(1/(L-1));<br>x = get(gca,'xlim');<br>xlabel('frequency');<br>ylabel('cortico-muscular PLI');<br>
hold on, line(x,[c95,c95],'linestyle','--','color','k'), hold off<br>% eval(['print -dpng beta_ppc_emg_rm1_patient_' LW240492 '.png']);<br>eval(['print -dpng gamma_pli_emg_rm1_control_' num2str(spmfilename(12:19)) '.png']);<br>
close(gcf); <br><br>%<br>% mean(fd.ppcspctrm(fd.freq>=15 & fd.freq<=30))<br>% <br>% ffreq = fd.freq(fd.freq>=15 & fd.freq<=30);<br>% [m, ind] = max(fd.ppcspctrm(ismember(fd.freq, ffreq)));<br>% disp(['Max ' num2str(m) ' at ' num2str(ffreq(ind)) ' Hz']);<br>
<br>end<br>%%<br><br></div><div>Many thanks!!<br></div></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-06-24 8:05 GMT+01:00 jan-mathijs schoffelen <span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Lidia,<div><br></div><div>Transforming a number that is bounded between -1 and 1 into a number that has absolute value and is bounded between 0 and 1 can be achieved by taking the abs().</div>
<div>Alternatively, you could compute the classic PLI from a time series of complex-valued cross-spectral density estimates by abs(mean(sign(angle(x))));</div><div><br></div><div>Best,</div><div>Jan-Mathijs</div><div><br>
</div><div><br><div><div><div><div class="h5"><div>On Jun 24, 2014, at 12:46 AM, Lidia Mijas <<a href="mailto:lid.mijas@gmail.com" target="_blank">lid.mijas@gmail.com</a>> wrote:</div><br></div></div><blockquote type="cite">
<div><div class="h5"><div dir="ltr"><div><div><div><div>Hi everyone,<br><br></div>I would like to compute a classic phase lag index between pairs of MEG time series. <br><br>So far I only found a wieghted phase lag index method implemented in ft and as far as I understand it is a directed measure so it gives the values from -1 to 1. Has anyone have an idea how to transform it so it computes  absolute values from 0 to 1???<br>

<br></div>Many thanks in advance.<br><br></div>Regards,<br></div>Lidia<br></div></div></div>
_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote>
</div><br><div>
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<div>Jan-Mathijs Schoffelen, MD PhD </div><div><br></div><div>Donders Institute for Brain, Cognition and Behaviour, <br>Centre for Cognitive Neuroimaging,<br>Radboud University Nijmegen, The Netherlands</div><div><br></div>
<div>Max Planck Institute for Psycholinguistics,</div><div>Nijmegen, The Netherlands</div><div><br></div><div><a href="mailto:J.Schoffelen@donders.ru.nl" target="_blank">J.Schoffelen@donders.ru.nl</a></div><div>Telephone: <a href="tel:%2B31-24-3614793" value="+31243614793" target="_blank">+31-24-3614793</a></div>
<div><br></div><div><a href="http://www.hettaligebrein.nl" target="_blank">http://www.hettaligebrein.nl</a></div></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></span>
</div>
<br></div></div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>