<div dir="ltr">This looks like it worked! Thank you so much Steve!<div><br></div><div>Tara</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 15, 2015 at 1:27 AM, Stephen Politzer-Ahles <span dir="ltr"><<a href="mailto:stephen.politzer-ahles@ling-phil.ox.ac.uk" target="_blank">stephen.politzer-ahles@ling-phil.ox.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi Tara,<br><br></div>It looks like the problem is that your EEG.event.type values are strings rather than numbers, and EEG.event.type itself is a series of structure field values (technically separate variables) rather than an array. Both of these prevent you from concatenating them with STLResponse, which is a simple numeric array. For example, notice how these types are different:<br><br>>> EEG.event(1:3).type<br><br>ans =<br><br>98  <br><br><br>ans =<br><br>98  <br><br><br>ans =<br><br>98  <br><br><br>>> STLResponse(1:3)<br><br>ans =<br><br>    98<br>    98<br>    98<br><br><br></div>Fortunately, this is easy to fix by just extracting the values of EEG.event.type and putting them into an array with the same shape as STLResponse. Replacing your last block of code with the following should do the trick:<br><br>%% Score startle peaks <br>        STLResponse = squeeze(max(EEGNA.data(1,find(EEGNA.times>=20 & EEGNA.times<=100),:))); %Identify peak response of startle trials in scoring window<br>        STLResponse = [arrayfun( @(x)(str2num(EEG.event(x).type)), 1:length(EEG.event) )' STLResponse]; %Store peak values by event type <br><br></div><div>or, in an easier-to-read version:<br><br>%% Score startle peaks <br>        STLResponse = 
squeeze(max(EEGNA.data(1,find(EEGNA.times>=20 & 
EEGNA.times<=100),:))); %Identify peak response of startle trials in 
scoring window<br></div><div>        triggers = arrayfun( 
@(x)(str2num(EEG.event(x).type)), 1:length(EEG.event) )'; % Pull out a list of event codes in array format<br></div><div>        STLResponse = [triggers STLResponse]; 
%Store peak values by event type <br><br></div><div><br></div>Best,<br></div>Steve<br></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><span><div><br><br>---<br></div>Stephen Politzer-Ahles<br>University of Oxford<br>Language and Brain Lab, Faculty of Linguistics, Phonetics & Philology<br><a href="http://users.ox.ac.uk/~cpgl0080/" target="_blank">http://users.ox.ac.uk/~cpgl0080/</a></span></div></div></div></div></div><div><div class="h5">
<br><div class="gmail_quote">On Mon, Sep 14, 2015 at 7:43 PM, Tara Miskovich <span dir="ltr"><<a href="mailto:miskovi2@uwm.edu" target="_blank">miskovi2@uwm.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thank you Steve,<div><br></div><div>Sorry for the delay, I have been trying to play around with the issue, but still appear stuck. I think I fixed the "<u style="font-size:12.8000001907349px">Error using horzcat </u><span style="font-size:12.8000001907349px">CAT arguments dimensions are not consistent." error, and I resampled to 1000hz so the the first issue shouldn't be there.</span><span style="font-size:12.8000001907349px"> </span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Now I am getting the "</span><span style="font-size:13.3333339691162px">Warning: Concatenation involves an empty array with an incorrect number of rows. </span><span style="font-size:13.3333339691162px">This may not be allowed in a future release." error again, and nothing is being calculated for the STLResponse. </span></div><div style="font-size:13.3333339691162px"><br></div><div style="font-size:13.3333339691162px">I attached the google drive link for the data and the script. Thank you so much, I cannot figure out how to get past this issue.</div><div style="font-size:13.3333339691162px"><br></div><div style="font-size:13.3333339691162px">Tara</div><div style="font-size:13.3333339691162px">​<br><div class="gmail_chip gmail_drive_chip" style="width:396px;min-height:18px;max-height:18px;background-color:#f5f5f5;padding:5px;color:#222;font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid #ddd;line-height:1"><a href="https://docs.google.com/a/ucdavis.edu/folderview?id=0B-sCc9Ecpq99QnRvc3FLYThIQlE&usp=drive_web" style="display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0px;border:none;width:100%" target="_blank"><img style="vertical-align:bottom;border:none" src="https://ssl.gstatic.com/docs/doclist/images/icon_11_collection_list.png"> <span dir="ltr" style="color:#15c;text-decoration:none;vertical-align:bottom">StartleProcessing</span></a></div>​</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 8, 2015 at 1:54 AM, Stephen Politzer-Ahles <span dir="ltr"><<a href="mailto:stephen.politzer-ahles@ling-phil.ox.ac.uk" target="_blank">stephen.politzer-ahles@ling-phil.ox.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hm, it's strange that the first warning message changed (first it was "Warning: Concatenation involves an empty array with an incorrect number of rows", now "Warning: Out of range or non-integer values truncated during conversion to character.") when I don't think it's related to the line that I suggested. Did you make any other changes higher up in the code?<br><br></div>As for the last error message, I suspect that's related to the last line of code (if the number of elements in STLResponse is different than the number in EEG.event.type, or if one of them needs to be transposed). You could try running through the code one line at a time to see where the error pops up. If that doesn't take care of it and no one else has a solution, you might need to try sharing the data (either via the EEGLAB Bugzilla, or via a link on e.g. Dropbox or Google Drive; the list doesn't allow attachments) so we can replicate the issue.<br><br></div>Best,<br></div>Steve<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 7, 2015 at 10:34 PM, Tara Miskovich <span dir="ltr"><<a href="mailto:miskovi2@uwm.edu" target="_blank">miskovi2@uwm.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for the response Steve. Thanks for catching that—it isn't exactly 1000. I ran the code you gave me and now this pops up. Thank you so much for the help with this.<div><br></div><div><span><div style="font-size:12.8000001907349px">pop_epoch():64 epochs selected</div><div style="font-size:12.8000001907349px">Epoching...</div><div style="font-size:12.8000001907349px">pop_epoch():64 epochs generated</div><div style="font-size:12.8000001907349px">pop_epoch(): checking epochs for data discontinuity</div><div style="font-size:12.8000001907349px">pop_rmbase(): Removing baseline...</div></span><div style="font-size:12.8000001907349px">Warning: Out of range or non-integer values truncated during conversion to character.</div></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Then I get:</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><u>Error using horzcat</u></div><div style="font-size:12.8000001907349px">CAT arguments dimensions are not consistent.</div></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Sat, Sep 5, 2015 at 4:03 PM, Stephen Politzer-Ahles <span dir="ltr"><<a href="mailto:stephen.politzer-ahles@ling-phil.ox.ac.uk" target="_blank">stephen.politzer-ahles@ling-phil.ox.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hello Tara,<br><br></div>It's hard to tell without seeing the data, but this sort of thing might happen when the timepoints in your data are not exactly e.g. 20 and 100 ms (which might be the case if your sampling rate was not 1000 Hz). Is the issue fixed if you replace the line in question with the following?<br><br>STLResponse = squeeze(max(EEG.data(1,find(EEG.times>=20 & EEG.times<=100),:)));<br><br></div>Best,<br></div>Steve<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Sat, Sep 5, 2015 at 8:17 PM, Tara Miskovich <span dir="ltr"><<a href="mailto:miskovi2@uwm.edu" target="_blank">miskovi2@uwm.edu</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hello all,<div><br></div><div>I am having difficulty with a script I obtained for processing startle data in EEGlab:<br clear="all"><div><br></div><div><div>%% High pass filter</div><div>        [HP28_1,HP28_2] = butter(2,28/(EEG.srate/2),'high');    % generate filter coefficient for 4th order 28Hz High pass Butterworth filter</div><div>        EEG.data = filtfilt(HP28_1,HP28_2,EEG.data);  %apply that filter to ORB channel; filter order is divided by 2 because we use the filtfilt function to avoid phase shifts in the data</div><div><br></div><div>%% Rectify </div><div>        EEG.data = abs(EEG.data); %the 'abs' function rectifies the data</div><div>        </div><div>%% Low pass filter </div><div>        [LP30_1,LP30_2] = butter(2,30/(EEG.srate/2),'low');    % generate filter coefficient for 4th order 30Hz Low pass Butterworth filter</div><div>        EEG.data = filtfilt(LP30_1,LP30_2,EEG.data);  %%apply that filter to ORB channel; filter order is divided by 2 because we use the filtfilt function to avoid phase shifts in the data</div><div><br></div><div>%% Epoch and baseline correct</div><div>        EventCodes = num2cell(unique([EEG.event.type])); %Extract event codes for epoching            </div><div>        EEG = pop_epoch( EEG, EventCodes, [-0.05 0.25], 'epochinfo', 'yes');  %Epoch file for events that indicate startle probes</div><div>        EEG = pop_rmbase( EEG, [-50   0]); %Baseline correct</div><div><br></div><div>%% Mark and reject trials with excessive artificat </div><div>        Artifact = squeeze(max(EEG.data(1,1:find(EEG.times==0),:)) - min( EEG.data(1,1:find(EEG.times==0),:)) > 40); %Identify trials with greater than 40 microvolt deflections in baseline</div><div>        EEGNA = pop_select(EEG,'notrial', find(Artifact)); %Reject these trials </div><div>        </div><div>%% Score startle peaks </div><div>        STLResponse = squeeze(max(EEG.data(1,find(EEG.times==20):find(EEG.times==100),:))); %Identify peak response of startle trials in scoring window</div><div>        STLResponse = [[EEG.event.type]' STLResponse]; %Store peak values by event type </div></div><div><br></div><div>I get the following output:</div><div><br></div><div>pop_epoch():64 epochs selected</div><div>Epoching...</div><div>pop_epoch():64 epochs generated</div><div>pop_epoch(): checking epochs for data discontinuity</div><div>pop_rmbase(): Removing baseline...</div><div>Warning: Concatenation involves an empty array with an incorrect number of rows.</div><div>This may not be allowed in a future release.</div><div><br></div><div>I am not sure what is the issue here, but after "STLResponse = squeeze(max(EEG.data(1,find(EEG.times==20):find(EEG.times==100),:))); %Identify peak response of startle trials in scoring window" I end up with an empty 0 by 64 matrix. </div><div><br></div><div>I am just a little new to this and can't seem to figure out what is going on here.</div><div><br></div><div>Thank you!</div><span><font color="#888888"><div>Tara</div><div><br></div>
</font></span></div></div>
<br></div></div>_______________________________________________<br>
Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" rel="noreferrer" target="_blank">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>
To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu" target="_blank">eeglablist-unsubscribe@sccn.ucsd.edu</a><br>
For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu" target="_blank">eeglablist-request@sccn.ucsd.edu</a><br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><span><font color="#888888"><div><br></div></font></span></div></div><span><font color="#888888"><span><font color="#888888">-- <br><div><div dir="ltr"><div><div dir="ltr"><font style="font-size:small;font-family:arial,helvetica,sans-serif">Thank you,<br><br></font><font size="2"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">Tara A. Miskovich, M.S.</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">Affective Neuroscience Laboratory</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">Department of Psychology</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">University of Wisconsin-Milwaukee</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">334 Garland Hall</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><a href="mailto:miskovi2@uwm.edu" target="_blank">miskovi2@uwm.edu</a></span></font><br></div></div></div></div>
</font></span></font></span></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br></font></span></div><span><font color="#888888">
</font></span></div></div></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><font style="font-size:small;font-family:arial,helvetica,sans-serif">Thank you,<br><br></font><font size="2"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">Tara A. Miskovich, M.S.</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">Affective Neuroscience Laboratory</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">Department of Psychology</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">University of Wisconsin-Milwaukee</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">334 Garland Hall</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><a href="mailto:miskovi2@uwm.edu" target="_blank">miskovi2@uwm.edu</a></span></font><br></div></div></div></div>
</font></span></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><font style="font-size:small;font-family:arial,helvetica,sans-serif">Thank you,<br><br></font><font size="2"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">Tara A. Miskovich, M.S.</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">Affective Neuroscience Laboratory</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">Department of Psychology</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">University of Wisconsin-Milwaukee</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)">334 Garland Hall</span><br style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><span style="font-family:arial,helvetica,sans-serif;color:rgb(33,33,33)"><a href="mailto:miskovi2@uwm.edu" target="_blank">miskovi2@uwm.edu</a></span></font><br></div></div></div></div>
</div>