<div dir="ltr">Hi Clemens,<div><br></div><div>There might be a better way to do this, but I usually just count as I'm deleting and subtract that from what I want to delete. Something like this:</div><div><br></div><div><div style="font-family:Courier;margin:0px"><p class="MsoNormal" style="margin-bottom:0.0001pt"><font size="1"><span style="font-family:'Courier New';color:black">del = 0;</span><span style="font-family:'Courier New'"></span></font></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><font size="1"><span style="font-family:'Courier New';color:blue">for</span><span style="font-family:'Courier New';color:black"> j = 1:size(EEG.event,2)</span><span style="font-family:'Courier New'"></span></font></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><font size="1"><span style="font-family:'Courier New';color:black"> </span><span style="font-family:'Courier New';color:blue">if</span><span style="font-family:'Courier New';color:black"> strcmp(EEG.event(j-del).type, </span><span style="font-family:'Courier New';color:rgb(160,32,240)">'DIN7'</span><span style="font-family:'Courier New';color:black">)</span><span style="font-family:'Courier New'"></span></font></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><font size="1"><span style="font-family:'Courier New';color:black"> EEG.event(j-del) = [];</span><span style="font-family:'Courier New'"></span></font></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><font size="1"><span style="font-family:'Courier New';color:black"> del = del + 1;</span><span style="font-family:'Courier New'"></span></font></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><font size="1"><span style="font-family:'Courier New';color:black"> </span><span style="font-family:'Courier New';color:blue">elseif</span><span style="font-family:'Courier New';color:black"> strcmp(EEG.event(j-del).type, </span><span style="font-family:'Courier New';color:rgb(160,32,240)">'boundary'</span><span style="font-family:'Courier New';color:black">)</span><span style="font-family:'Courier New'"></span></font></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><font size="1"><span style="font-family:'Courier New';color:black"> EEG.event(j-del) = [];</span><span style="font-family:'Courier New'"></span></font></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><font size="1"><span style="font-family:'Courier New';color:black"> del = del + 1;</span><span style="font-family:'Courier New'"></span></font></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><font size="1"><span style="font-family:'Courier New';color:black"> </span><span style="font-family:'Courier New';color:blue">end</span><span style="font-family:'Courier New'"></span></font></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-family:'Courier New';color:blue"><font size="1">end</font></span></p></div></div><div><br></div><div>Hope that helps,<br></div><div><br></div><div>Katie</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 26, 2016 at 5:36 AM, Clemens DICKHUT <span dir="ltr"><<a href="mailto:clemens.dickhut@uni.lu" target="_blank">clemens.dickhut@uni.lu</a>></span> wrote:<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 all,
<div><br>
</div>
<div>I’d like to remove rows in EEG.event that I don’t need. </div>
<div><br>
</div>
<div>Is there a straight forward way to delete rows in a struct array with fields, depending on a particular field entry?</div>
<div>I tried the following: </div>
<div><br>
</div>
<div>
<div style="margin:0px;font-size:11px;line-height:normal;font-family:Courier">
<div style="margin:0px;line-height:normal"><span style="color:#0433ff">for</span> b = 1:length(EEG.event) </div>
<p style="margin:0px;line-height:normal;min-height:13px"> <br>
</p>
<div style="margin:0px;line-height:normal"> <span style="color:#0433ff">
if</span> strcmp(EEG.event(b).type, <span style="color:#b245f3">'boundary'</span>)</div>
<div style="margin:0px;line-height:normal"> EEG.event(b) = [];</div>
<div style="margin:0px;line-height:normal"> <span style="color:#0433ff">
elseif</span> strcmp(EEG.event(b).type, <span style="color:#b245f3">'R 1'</span>)</div>
<div style="margin:0px;line-height:normal"> EEG.event(b) = [];</div>
<div style="margin:0px;line-height:normal"> <span style="color:#0433ff">
end</span></div>
<p style="margin:0px;line-height:normal;min-height:13px"> <br>
</p>
<div style="margin:0px;line-height:normal;color:rgb(4,51,255)">end</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
<div>Putting a for loop around it doesn’t help much as b exceeds the new EEG.event length at some point...</div>
<div><br>
</div>
<div></div>
<div>Hope someone can help. Thanks a lot in advance. </div>
<div><br>
</div>
<div>Best, </div>
<div>Clemens </div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
__________________________________</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
Clemens Dickhut, M.Sc., (PhD Student) <br>
Institute for Health and Behaviour<br>
Research Unit INSIDE<br>
University of Luxembourg - Campus Belval<br>
Maison des Sciences Humaines<br>
11, Porte des Sciences, R. 04 415<br>
L-4366 Esch-sur-Alzette</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
Tel.: (+352) 46 66 44 9536<br>
</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>
</div>
</div>
<br>
</div>
<br>
</div>
</div>
<br>_______________________________________________<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">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">eeglablist-request@sccn.ucsd.edu</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Katie Lavigne , PhD Candidate<br><span style="font-size:12.8px">Cognitive Neuropsychiatry of Schizophrenia Lab</span><br style="font-size:12.8px"><span style="font-size:12.8px">BC Mental Health and Addictions Research Institute (BCMHARI)</span><br style="font-size:12.8px"><span style="font-size:12.8px">3rd floor, 938 West 28th ave. </span><br style="font-size:12.8px"><span style="font-size:12.8px">Vancouver, BC</span><br style="font-size:12.8px"><span style="font-size:12.8px">V5Z 4H4</span><br><div><br></div><div>Phone: (604) 875-2000 x 4734</div></div></div></div></div></div></div>
</div>