%% This function enables to plot the average time course, across subjects, % of ISFC changes for a given connection % % Inputs: % % - SignMat is the 3D (n_conn x n_tp x n_subj) matrix of ISFC excursions % - R1 and R2 are integer indices of two regions of interest, for which the % ISFC changes should be plotted % - t_start and t_end are the start and end times of the movie (in [s]), % while TR is the TR value function [] = Plot_Conn_TimeCourse(SignMat,R1,R2,t_start,t_end,TR,PatchColor,MainColor) % M contains only 1 non-null value, at the connection linked to the % region pair of interest n_ROI = (1+sqrt(1+4*2*size(SignMat,1)))/2; M = zeros(n_ROI,n_ROI); M(R1,R2) = 1; tmp_conn = squeeze(SignMat(logical(jUpperTriMatToVec(M)),:,:)); n_subj = size(tmp_conn,2); % Time t = t_start:TR:t_end; figure; plot_ci(t',[mean(tmp_conn,2),mean(tmp_conn,2)-std(tmp_conn,[],2)/sqrt(n_subj)*1.96,mean(tmp_conn,2)+std(tmp_conn,[],2)/sqrt(n_subj)*1.96],... 'PatchColor', PatchColor, 'PatchAlpha', 0.25, 'MainLineWidth', 2, ... 'MainLineColor', MainColor, 'LineWidth', 1, 'LineStyle','-', ... 'LineColor', 'none'); hold on; set(gcf,'color','w'); set(gca,'Box','off'); xlabel('Time [s]'); ylabel('ISFC change consistency [-]'); title(['Connection ',num2str(R1),'-',num2str(R2)]); xlim([t_start,t_end]); ylim([-0.4 1]); end