%Creating the regressor for the GLM from the coefficent of correlation
%resulted from the fitting process.
fs = 250; %frequency sample rate
NTR = 400; % number of trigs resulted by Scan Star
TR= 750;%trigs(end+1)=trigs(end)+round(mean(diff(trigs)));
trigs=TR:TR*fs:NTR*TR*fs;fit_corr = (data(:,5)).^2; % taking the 5th column of the file (correlation) and squared it to have the coefficent of determination
% fit_corr = data(:,5);
% mean_r2=mean(fit_corr(trigs(1):trigs(end))) %for each TR, take the mean value
hrf= spm_hrf(1/fs); %convolution of the vector resulted from above
% hrf=hrf/std(hrf);
% td = diff(hrf);
% td=td/std(td);
% dd = diff(td);
% dd=dd/std(dd);
reg = conv(fit_corr,hrf);% reg_td = conv(fit_corr,td);
% reg_dd = conv(fit_corr,dd);
reg_fit = zeros(NTR,1);% reg_fit_td = zeros(NTR,1);
% reg_fit_dd = zeros(NTR,1);
%sign=mean(reg(10302:750:309648));
for i=1:NTR regr_fit(i)=mean(reg(trigs(i):trigs(i))); % reg_fit_td(i)=mean(reg_td(trigs(i):trigs(i+1)-1));
% reg_fit_dd(i)=mean(reg_dd(trigs(i):trigs(i+1)-1));
endfigureplot(regr_fit)% plot (sign)
MATLAB: What’s wrong on the script that gives me Index exceeds matrix dimensions error??????
index exceeding
Best Answer