Commit a9a334d4 authored by Julius Welzel's avatar Julius Welzel

Upload New File

parent 8faaab06
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Topo diff with RTs in juw_el_table // Both groups
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Cortical area with RTs
% Author: Julius Welzel // University of Oldenburg, 2019
% Version: 1.0 // 17.03.2019 // Initial setup
% define paths
PATHIN_TOPDIFF = [MAIN '04_Data\ana07_topdiff\'];
PATHIN_SUBJ = [MAIN '04_Data\'];
PATHIN_RTs = [MAIN '04_Data\ana04_erd\'];
PATHIN_EMG = [MAIN '04_Data\ana03_emg\'];
PATHOUT_SCAT = [MAIN '04_Data\ana08_rela\'];
if ~exist(PATHOUT_SCAT)
mkdir(PATHOUT_SCAT);
end
%define FBs
FB = {'mue','beta','broad'};
%load data
load([PATHIN_RTs 'cfg.mat']);
cfg.n_trials = 96;
load ([PATHIN_EMG 'emg_all.mat']);
load ([PATHIN_RTs 'RTs.mat']);
for fb = 1:length(FB)
area(fb).name = FB{fb};
data = load([PATHIN_TOPDIFF 'inter_area_' FB{fb} '.mat']);
area(fb).data = data.area_z_t_avg;
end
list = dir(fullfile([PATHIN_SUBJ 'ana02_clean\*clean*.set']));
SUBJ = extractBefore({list.name},'_');
SUBJ = str2double(SUBJ);
old = (SUBJ>=80);
young = (SUBJ<80);
% define trails of interest
ME_trials = [cfg.blck_idx{[1 4],1}];
MI_trials = [cfg.blck_idx{[2 3],1}];
%define FBs
FB = {'mue','beta','broad'};
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Get delta ME-MI in ms from RTs
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
old = (SUBJ>=80);
young = (SUBJ<80);
g_idx = ones(1,(length(RT)));
g_idx(old) = 2;
blocks = cell(1,cfg.n_trials);
blocks(cfg.blck_idx{1,1}) = {'EX1'};
blocks(cfg.blck_idx{2,1}) = {'MI1'};
blocks(cfg.blck_idx{3,1}) = {'MI2'};
blocks(cfg.blck_idx{4,1}) = {'EX2'};
for t = 1:length(RT)
ex1(:,t) = RT(t).times(cfg.blck_idx{1,1});
ex1(~emg_check(t).trials_valid(cfg.blck_idx{1,1}),t) = NaN;
mi1(:,t) = RT(t).times(cfg.blck_idx{2,1});
mi2(:,t) = RT(t).times(cfg.blck_idx{3,1});
if length(RT(t).times)>100
ex2(:,t) = RT(t).times(249:256);
ex2(~emg_check(t).trials_valid(249:256),t) = NaN;
else
ex2(:,t) = RT(t).times(cfg.blck_idx{4,1});
ex2(~emg_check(t).trials_valid(cfg.blck_idx{4,1}),t) = NaN;
end
end
RT_all = [ex1;mi1 ;mi2 ;ex2];
diff_RT = abs(nanmean(RT_all(ME_trials,:))-nanmean(RT_all(MI_trials,:)));
diff_RT_o = abs(nanmean([ex1(:,old);ex2(:,old)])-nanmean([mi1(:,old);mi2(:,old)]));
diff_RT_y = abs(nanmean([ex1(:,young);ex2(:,young)])-nanmean([mi1(:,young);mi2(:,young)]));
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% relate RTs to intersect area
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% find maximal diff in intersect area between young & old
for fb = 1:length(FB)
figure
% find maximal diff in intersect area between young & old
[v i] = max(mean(area(fb).data(old,:))-mean(area(fb).data(young,:)));
sc = gscatter(diff_RT,area(fb).data(:,i),g_idx,[],[],25)
corr_y = round(corr(diff_RT(:,young)',area(fb).data(young,i)),2);
corr_o = round(corr(diff_RT(:,old)',area(fb).data(old,i)),2);
sc(1).Color = c_young;
sc(2).Color = c_old;
l = lsline;
l(1).LineWidth = 1.5;
l(2).LineWidth = 1.5;
title ([area(fb).name num2str(i)])
legend ([sc(1) sc(2)],{['Young // r: ' num2str(corr_y)],['Old // r: ' num2str(corr_o)]})
legend boxoff
xlabel '\Delta ME-MI RTs [ms]'
ylabel 'Area at intersect [u]'
save_fig(gcf,PATHOUT_SCAT,['area_dRT_' FB{fb}],'fontsize',20,'figsize',[0 0 35 20]);
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment