<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:"Times New Roman",Times,serif; font-size:12pt; color:rgb(0,0,0)">
Hello,</div>
<div style="font-family:"Times New Roman",Times,serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Times New Roman",Times,serif; font-size:12pt; color:rgb(0,0,0)">
I am running into this warning (<b style="font-size:12pt;background-color:rgb(255, 255, 255)">Warning: Iteration limit reached)</b> with the r<span style="color: rgb(0, 0, 0); font-family: "Times New Roman", Times, serif; font-size: 12pt;">est analysis slope
 code below.</span><b style="font-size: 12pt; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit;"></b></div>
<div>
<div style="font-family:"Times New Roman",Times,serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Times New Roman",Times,serif; font-size:12pt; color:rgb(0,0,0)">
%% Create Slope Data
<div><br>
</div>
<div>for subj = subj_list</div>
<div>    </div>
<div>    subject = subjname{subj};</div>
<div>    restdir  = [maindir subject '/rest/'];</div>
<div>    fftdir = [restdir 'fft/'];</div>
<div>    slopedir  = [restdir 'slope/'];</div>
<div>    if(exist(slopedir, 'dir') == 0)</div>
<div>        mkdir(slopedir);</div>
<div>    end</div>
<div>    cd(restdir);</div>
<div>    load([fftdir 'fft_rest_matched.mat'],'fft_car')</div>
<div>    </div>
<div>     % select channels</div>
<div>    cfg = [];</div>
<div>    cfg.channel = ft_channelselection({'F*','C*'}, fft_car.label);</div>
<div>    fft_car = ft_selectdata(cfg,fft_car);</div>
<div>    </div>
<div>    % determine frequency indices</div>
<div>    lf = find(30==round(fft_car.freq,0));</div>
<div>    hf = find(50==round(fft_car.freq,0));</div>
<div>    </div>
<div>   % compute slope</div>
<div>    for c=1:size(fft_car.powspctrm,2) % channel</div>
<div>        for tr=1:size(fft_car.powspctrm,1) % trial</div>
<div>            </div>
<div>            power = []; rfit = [];</div>
<div>            power = log10(squeeze(fft_car.powspctrm(tr,c,lf:hf)));</div>
<div>            rfit = robustfit(log10(fft_car.powspctrm(lf:hf)),power);</div>
<div>            slope_rest(c,tr) = rfit(2);</div>
<div>            </div>
<div>        end</div>
<div>    end</div>
<div>    </div>
<div>     % for each channel create average across trials</div>
<div>    for c = 1:size(slope_rest,1)</div>
<div>        slope_rest_avg(c,1) = mean(slope_rest(c,:),2);</div>
<div>    end</div>
<div>    </div>
<div>    filename = strcat('slope_rest_car.mat');</div>
<div>    save([slopedir filename],'slope_rest','slope_rest_avg');</div>
<div>    </div>
<div>    clear c tr fft_car slope_rest*</div>
<div>    </div>
end<br>
</div>
<div style="font-family:"Times New Roman",Times,serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Times New Roman",Times,serif; font-size:12pt; color:rgb(0,0,0)">
Any help would be appreciated.</div>
<div style="font-family:"Times New Roman",Times,serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Times New Roman",Times,serif; font-size:12pt; color:rgb(0,0,0)">
Sincerely,</div>
<div style="font-family:"Times New Roman",Times,serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div id="Signature">
<div>
<div></div>
<div></div>
<div></div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; margin-bottom:0px">
</p>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(33,33,33)">
<span style="font-size:12pt; font-family:"Times New Roman",Times,serif">Michelle (Yee Suet) Wong</span></div>
<span style="font-family:"Times New Roman",Times,serif"></span>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(33,33,33)">
<span style="font-family:"Times New Roman",Times,serif"></span><span style="font-size:12pt; font-family:"Times New Roman",Times,serif">BHK, MSc, PhD Candidate</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(33,33,33)">
<span style="font-size:12pt; font-family:"Courier New",monospace"><span style="color:rgb(33,33,33); font-family:"Times New Roman",Times,serif; font-size:16px">Western University</span><br>
</span></div>
<span style="font-family:"Times New Roman",Times,serif"></span>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(33,33,33)">
<span style="font-family:"Times New Roman",Times,serif"></span><span style="font-size:12pt; font-family:"Times New Roman",Times,serif">School of </span><font color="#212121" face="Courier New, monospace"><span style="font-family:"Times New Roman",Times,serif">Kinesiology </span></font></div>
<span style="font-family:"Times New Roman",Times,serif"></span>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(33,33,33)">
<span style="font-family:"Times New Roman",Times,serif"></span><font color="#212121" face="Courier New, monospace"><span style="font-family:"Times New Roman",Times,serif">Faculty of Health Sciences</span></font></div>
<span style="font-family:"Times New Roman",Times,serif"></span>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(33,33,33)">
<span style="font-family:"Times New Roman",Times,serif"></span><span style="font-size:12pt; font-family:"Courier New",monospace"><span style="color:rgb(33,33,33); font-family:"Times New Roman",Times,serif; font-size:16px">Exercise, Mobility, and Brain Health
 Lab</span></span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(33,33,33)">
<span style="font-family:"Times New Roman",Times,serif"></span><span style="font-size:12pt; font-family:"Times New Roman",Times,serif">London, Ontario, Canada</span></div>
<div><span style="font-size:12pt; font-family:"Courier New",monospace"><br>
</span></div>
<br>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; margin-bottom:0px">
</p>
</div>
</div>
</div>
</div>
</body>
</html>