<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi all,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'm brand new to fieldtrip, so I apologize for what may be a remedial question. I have resting-state continuous EEG data (71 channels, sampling rate 1000Hz, 7 minutes in length) and I'm trying to write a script to analyze connectivity with WPLI. I'm running
 into two issues right now: </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
1.) When I try to specify a frequency range with cfg.foi in ft_freqanalysis, I keep receiving an error that the frequencies are above the Nyquist. My sampling rate is 1000Hz, so I'm confused about this error when I'm only entering values up to 60Hz.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
2.) When I forgo using cfg.foi and run through the script, I keep ending up with a WPLI spectrum matrix of NaN values and an error message that WPLI requires >1 trial. I've tried segmenting my data and trying to keep trials throughout frequency analysis, but
 this does not appear to be working.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you to all readers - I am open to any suggestions! The script I've been using:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
%load set from EEGLAB
<div>datafile = pop_loadset('data.set')</div>
<div><br>
</div>
<div>%format set into fieldtrip compatible structure</div>
<div>hdr = ft_read_header('data.set')</div>
<div>ftdata = []</div>
<div>ftdata.time = datafile.times</div>
<div>ftdata.trial = ft_read_data('data.set','data',hdr)</div>
<div>ftdata.label = hdr.label</div>
<div>ftdata.fsample = 1000.0</div>
<div>ftdata.dimord = 'chan_time'</div>
<div><br>
</div>
<div>%segment data</div>
<div>cfg0 = []</div>
<div>cfg0.length = 105250</div>
<div>cfg0.overlap = 0</div>
<div>freq1 = ft_redefinetrial(cfg0, ftdata)</div>
<div><br>
</div>
<div>%check datatyppe</div>
<div>data2 = ft_datatype(freq1)</div>
<div><br>
</div>
<div>cfg2 = []</div>
<div>cfg2.covariance = 'yes'</div>
<div>cfg2.keeptrials = 'yes'</div>
<div>[freq] = ft_timelockanalysis(cfg2, freq1)</div>
<div><br>
</div>
<div>%frequency analysis</div>
<div>cfg8 = []</div>
<div>cfg8.method = 'mtmfft'</div>
<div>cfg8.taper = 'hanning'</div>
<div>cfg8.keeptrials = 'yes'</div>
<div>cfg8.output = 'powandcsd'</div>
<div>cfg8.foi = 9.0:1.0:20.0</div>
<div>freq.label = hdr.label</div>
<div>freq.fsample = 1000.0</div>
<div>freq10 = ft_freqanalysis(cfg8, freq)</div>
<div><br>
</div>
<div>%check datatype</div>
<div>data5 = ft_datatype(freq10)</div>
<div><br>
</div>
<div>%calculate wpli</div>
<div>cfg4 = []</div>
<div>cfg4.method = 'wpli'</div>
[wpli] = ft_connectivityanalysis(cfg4, freq10)<br>
</div>
</body>
</html>