diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..5f7da4a --- /dev/null +++ b/README.txt @@ -0,0 +1,5 @@ +README.txt + +The LInear MOdelling of EEG data (LIMO EEG) toolbox is a Matlab toolbox dedicated to the analysis of MEEG data. It is interfaced with EEGLAB to act as a plug in. However, once data are imported all is performed within LIMO EEG and the toolbox can thus work for any data sets. + +The repository is the developmental version - the stable version can be downlaoaded from https://gforge.dcn.ed.ac.uk/gf/project/limo_eeg/ \ No newline at end of file diff --git a/limo_design_matrix_tf.m b/limo_design_matrix_tf.m index d8b8719..fccd6e0 100644 --- a/limo_design_matrix_tf.m +++ b/limo_design_matrix_tf.m @@ -60,6 +60,7 @@ full_factorial = varargin{2}.design.fullfactorial; chanlocs = varargin{2}.data.chanlocs; type_of_analysis = varargin{2}.design.type_of_analysis; + size3D = varargin{2}.data.size3D; flag = varargin{3}; try expected_chanlocs = varargin{2}.data.expected_chanlocs; @@ -412,18 +413,21 @@ % Reorder this Yr to save this as 4D Yr=limo_tf_4d_reshape(Yr); -save Yr Yr ; +save Yr Yr -v7.3; % no matter the analysis we have Beta, Yhat, Res -Yhat = zeros(LIMO.data.size3D); save Yhat Yhat; clear Yhat -Res = zeros(LIMO.data.size3D); save Res Res; clear Res -Betas = zeros(LIMO.data.size3D(1),LIMO.data.size3D(2),size(X,2)); save Betas Betas; clear Betas -% note - overwritten in limo_eeg_tf, saved here for size-check +Yhat = zeros(size3D); +Res = zeros(size3D); +Betas = zeros(size3D(1),size3D(2),size(X,2)); +% note - overwritten in limo_eeg_tf, saved here for size-check +save Yhat Yhat -v7.3; clear Yhat +save Res Res -v7.3; clear Res +save Betas Betas -v7.3; clear Betas % only for univariate analyses if strcmp(type_of_analysis,'Mass-univariate') - R2 = zeros(LIMO.data.size3D(1),LIMO.data.size3D(2),3); save R2 R2; + R2 = zeros(size3D(1),size3D(2),3); save R2 R2 -v7.3; end clear Yr R2 diff --git a/limo_display_results.m b/limo_display_results.m index d2c73a5..8a357e7 100644 --- a/limo_display_results.m +++ b/limo_display_results.m @@ -201,110 +201,120 @@ function limo_display_results(Type,FileName,PathName,p,MCC,LIMO,flag) save LIMO LIMO end - % imagesc - ax(1) = subplot(3,3,[1 2 4 5 7 8]); - if LIMO.analysis_flag == 1 - timevect = linspace(LIMO.data.start*1000,LIMO.data.end*1000,size(toplot,2)); - ratio = timevect(2)-timevect(1); % (LIMO.data.end*1000 - LIMO.data.start*1000) / size(toplot,2); - if LIMO.data.start < 0 - frame_zeros = find(timevect == 0); - if isempty(frame_zeros) - frame_zeros = round(abs(LIMO.data.start*1000) / ratio)+1; + + if LIMO.analysis_flag ~= 3 % 2D maps + % imagesc + ax(1) = subplot(3,3,[1 2 4 5 7 8]); + if LIMO.analysis_flag == 1 + timevect = linspace(LIMO.data.start*1000,LIMO.data.end*1000,size(toplot,2)); + ratio = timevect(2)-timevect(1); % (LIMO.data.end*1000 - LIMO.data.start*1000) / size(toplot,2); + if LIMO.data.start < 0 + frame_zeros = find(timevect == 0); + if isempty(frame_zeros) + frame_zeros = round(abs(LIMO.data.start*1000) / ratio)+1; + end + else + frame_zeros = 1; end - else - frame_zeros = 1; + scale = toplot.*mask; scale(scale==0)=NaN; + imagesc(timevect,1:size(toplot,1),scale); + + elseif LIMO.analysis_flag == 2 + freqvect=linspace(LIMO.data.freq_list(1),LIMO.data.freq_list(end),size(toplot,2)); + frame_zeros = 1; ratio = freqvect(2)-freqvect(1); + scale = toplot.*mask; scale(scale==0)=NaN; + imagesc(freqvect,1:size(toplot,1),scale); end - scale = toplot.*mask; scale(scale==0)=NaN; - imagesc(timevect,1:size(toplot,1),scale); - elseif LIMO.analysis_flag == 2 || LIMO.analysis_flag == 3 - freqvect=linspace(LIMO.data.freq_list(1),LIMO.data.freq_list(end),size(toplot,2)); - scale = toplot.*mask; scale(scale==0)=NaN; - imagesc(freqvect,1:size(toplot,1),scale); - end - - v = max(toplot(:)); [e,f]=find(toplot==v); - try - caxis([min(min(scale)), max(max(scale))]); - catch caxiserror - end - color_images_(scale,LIMO); - title(mytitle,'Fontsize',16) - - if length(e)>1 % happen if we have multiple times the exact same max values - e = e(1); f = f(1); % then we take the 1st (usually an artefact but allows to see it) - end - - % ERP plot at best electrode - ax(3) = subplot(3,3,9); - - if LIMO.analysis_flag == 1 - mytitle2 = sprintf('time course @ \n electrode %s (%g)', LIMO.data.chanlocs(e).labels,LIMO.data.chanlocs(e).urchan); - plot(timevect,toplot(e,:),'LineWidth',3); grid on; axis tight - elseif LIMO.analysis_flag == 2 - mytitle2 = sprintf('power spectra @ \n electrode %s (%g)', LIMO.data.chanlocs(e).labels,LIMO.data.chanlocs(e).urchan); - plot(freqvect,toplot(e,:),'LineWidth',3); grid on; axis tight - end - title(mytitle2,'FontSize',12) - - % topoplot at max time - ax(2) = subplot(3,3,6); - chans = LIMO.data.chanlocs; - topoplot(toplot(:,f),chans,'maplimits','maxmin'); - if LIMO.analysis_flag == 1 - title(['topoplot @ ' num2str(round(timevect(f))) 'ms'],'FontSize',12) - set(gca,'XTickLabel', timevect); - elseif LIMO.analysis_flag == 2 - title(['topoplot @' num2str(round(timevect(f))) 'Hz'],'FontSize',12); - set(gca,'XTickLabel', LIMO.data.freq_list); - end; - - % update with mouse clicks - if flag == 1 - update = 0; - while update ==0 - try - [x,y,button]=ginput(1); - catch - update =1; break - end - if button > 1 - update = 1; - end - clickedAx = gca; - if clickedAx ~=ax(1) - disp('right click to exit') - else - frame = frame_zeros + round(x / ratio); - - % ERP plot at best electrode and topoplot - % at max time or freq - y = round(y); - if LIMO.analysis_flag == 1; % If time analysis - mytitle2 = sprintf('time course @ \n electrode %s (%g)', LIMO.data.chanlocs(e).labels,LIMO.data.chanlocs(e).urchan); - subplot(3,3,9,'replace'); - plot(timevect,toplot(e,:),'LineWidth',3); grid on; axis tight - subplot(3,3,6,'replace'); - topoplot(toplot(:,frame),LIMO.data.chanlocs); - title(['topoplot @ ' num2str(round(x)) 'ms'],'FontSize',12) - - elseif LIMO.analysis_flag == 2 % If freq analysis - mytitle2 = sprintf('power spectra @ \n electrode %s (%g)', LIMO.data.chanlocs(e).labels,LIMO.data.chanlocs(e).urchan); - subplot(3,3,9,'replace'); - plot(freqvect,toplot(e,:),'LineWidth',3); grid on; axis tight - subplot(3,3,6,'replace'); - topoplot(toplot(:,frame),LIMO.data.chanlocs); - title(['topoplot @ ' num2str(round(x)) 'Hz'],'FontSize',12) - - end + v = max(toplot(:)); [e,f]=find(toplot==v); + try + caxis([min(min(scale)), max(max(scale))]); + catch caxiserror + end + color_images_(scale,LIMO); + title(mytitle,'Fontsize',16) + + if length(e)>1 % happen if we have multiple times the exact same max values + e = e(1); f = f(1); % then we take the 1st (usually an artefact but allows to see it) + end + + % ERP plot at best electrode + ax(3) = subplot(3,3,9); + + if LIMO.analysis_flag == 1 + mytitle2 = sprintf('time course @ \n electrode %s (%g)', LIMO.data.chanlocs(e).labels,LIMO.data.chanlocs(e).urchan); + plot(timevect,toplot(e,:),'LineWidth',3); grid on; axis tight + elseif LIMO.analysis_flag == 2 + mytitle2 = sprintf('power spectra @ \n electrode %s (%g)', LIMO.data.chanlocs(e).labels,LIMO.data.chanlocs(e).urchan); + plot(freqvect,toplot(e,:),'LineWidth',3); grid on; axis tight + end + title(mytitle2,'FontSize',12) + + % topoplot at max time + ax(2) = subplot(3,3,6); + chans = LIMO.data.chanlocs; + topoplot(toplot(:,f),chans,'maplimits','maxmin'); + if LIMO.analysis_flag == 1 + title(['topoplot @ ' num2str(round(timevect(f))) 'ms'],'FontSize',12) + set(gca,'XTickLabel', timevect); + elseif LIMO.analysis_flag == 2 + title(['topoplot @' num2str(round(freqvect(f))) 'Hz'],'FontSize',12); + set(gca,'XTickLabel', LIMO.data.freq_list); + end; + + % update with mouse clicks + if flag == 1 + update = 0; + while update ==0 try - mytitle2 = sprintf('time course @ \n electrode %s (%g)', LIMO.data.expected_chanlocs(y).labels,LIMO.data.expected_chanlocs(y).urchan); - catch ME - mytitle2 = sprintf('time course @ \n electrode %s (%g)', LIMO.data.chanlocs(y).labels,LIMO.data.chanlocs(y).urchan); + [x,y,button]=ginput(1); + catch + update =1; break + end + if button > 1 + update = 1; + end + clickedAx = gca; + if clickedAx ~=ax(1) + disp('right click to exit') + else + frame = frame_zeros + round(x / ratio); + % ERP plot at best electrode and topoplot + % at max time or freq + y = round(y); + if LIMO.analysis_flag == 1; % If time analysis + subplot(3,3,6,'replace'); + topoplot(toplot(:,frame),LIMO.data.chanlocs); + title(['topoplot @ ' num2str(round(x)) 'ms'],'FontSize',12) + + subplot(3,3,9,'replace'); + plot(timevect,toplot(y,:),'LineWidth',3); grid on; axis tight + mytitle2 = sprintf('time course @ \n electrode %s (%g)', LIMO.data.chanlocs(e).labels,LIMO.data.chanlocs(e).urchan); + title(mytitle2,'FontSize',12); + + elseif LIMO.analysis_flag == 2 % If freq analysis + subplot(3,3,6,'replace'); + topoplot(toplot(:,frame),LIMO.data.chanlocs); + title(['topoplot @ ' num2str(round(x)) 'Hz'],'FontSize',12) + + subplot(3,3,9,'replace'); + plot(freqvect,toplot(y,:),'LineWidth',3); grid on; axis tight + mytitle2 = sprintf('power spectra @ \n electrode %s (%g)', LIMO.data.chanlocs(y).labels,LIMO.data.chanlocs(y).urchan); + title(mytitle2,'FontSize',12); + + end + try + mytitle2 = sprintf('time course @ \n electrode %s (%g)', LIMO.data.expected_chanlocs(y).labels,LIMO.data.expected_chanlocs(y).urchan); + catch ME + mytitle2 = sprintf('time course @ \n electrode %s (%g)', LIMO.data.chanlocs(y).labels,LIMO.data.chanlocs(y).urchan); + end + title(mytitle2,'FontSize',12) end - title(mytitle2,'FontSize',12) end end + + else % LIMO.analysis_flag == 3 - 3D maps + limo_time_freq_display(toplot,timevect,freqvect,mytitle); end end @@ -741,7 +751,7 @@ function limo_display_results(Type,FileName,PathName,p,MCC,LIMO,flag) ylabel('Amplitude in {\mu}V','FontSize',16) elseif LIMO.analysis_flag == 2 xlabel('Freq in Hz','FontSize',16) - ylabel('Power spectra density'); + ylabel('Power spectral density','FontSize',16); end LIMO.cache.ERPplot = average; diff --git a/limo_eeg.m b/limo_eeg.m index d929edd..62732fe 100644 --- a/limo_eeg.m +++ b/limo_eeg.m @@ -193,7 +193,7 @@ function limo_eeg(varargin) elseif LIMO.analysis_flag == 3 % Time-Frequency power values clear EEG; disp('Time-Frequency implementation - loading tf data...'); Y=load(LIMO.data.tf_data_filepath); % Load tf data from path in *.set from import stage - Y=Y.limo_tf(:,LIMO.data.trim_low_f:LIMO.data.trim_high_f,LIMO.data.trim_low_t:LIMO.data.trim_high_t,:); + Y=Y.limo_tf(:,LIMO.data.trim_low_f:LIMO.data.trim_high_f,LIMO.data.trim1:LIMO.data.trim2,:); LIMO.data.size4D=size(Y); LIMO.data.freq_list=repmat(LIMO.data.tf_freqs,[1 numel(LIMO.data.tf_times)]); LIMO.data.size3D= [LIMO.data.size4D(1) numel(LIMO.data.tf_freqs)*numel(LIMO.data.tf_times) LIMO.data.size4D(4)]; @@ -420,12 +420,13 @@ function limo_eeg(varargin) end % save data on the disk and clean out + disp('saving data to disk') LIMO.design.X = X; LIMO.design.weights = W; LIMO.design.status = 'done'; - save LIMO LIMO; save Yhat Yhat; - save Res Res; save Betas Betas; - save R2 R2; clear Yhat Res Betas R2 + save LIMO LIMO; save Yhat Yhat -v7.3; + save Res Res; save Betas Betas -v7.3; + save R2 R2 -v7.3; clear Yhat Res Betas R2 if prod(LIMO.design.nb_conditions) ~=0 for i=1:length(LIMO.design.nb_conditions) @@ -634,92 +635,95 @@ function limo_eeg(varargin) end end + % TFCE if requested % -------------- - load Yr; - if LIMO.design.tfce == 1 && isfield(LIMO.data,'neighbouring_matrix') && size(Yr,1) > 1 && LIMO.design.bootstrap ~=0 - clear Yr; - if exist('TFCE','dir') - if strcmp(questdlg('TFCE directory detected, overwrite?','data check','Yes','No','No'),'No'); - return - end - end - - fprintf('\n %%%%%%%%%%%%%%%%%%%%%%%% \n Computing TFCE for GLM takes a while, be patient .. \n %%%%%%%%%%%%%%%%%%%%%%%% \n') - mkdir TFCE; - - % R2 - load R2.mat; fprintf('Creating R2 TFCE scores \n'); cd('TFCE'); - tfce_score = limo_tfce(squeeze(R2(:,:,2)),LIMO.data.neighbouring_matrix); - save('tfce_R2','tfce_score'); clear R2; cd ..; - - cd('H0'); fprintf('Thresholding H0_R2 using TFCE \n'); load H0_R2; - tfce_H0_score = limo_tfce(squeeze(H0_R2(:,:,2,:)),LIMO.data.neighbouring_matrix); - save('tfce_H0_R2','tfce_H0_score'); clear H0_R2; cd ..; - - % conditions - if prod(LIMO.design.nb_conditions) ~=0 - for i=1:length(LIMO.design.nb_conditions) - name = sprintf('Condition_effect_%g.mat',i); load(name); - cd('TFCE'); fprintf('Creating Condition %g TFCE scores \n',i) - tfce_score = limo_tfce(squeeze(Condition_effect(:,:,1)),LIMO.data.neighbouring_matrix); - full_name = sprintf('tfce_%s',name); save(full_name,'tfce_score'); - clear Condition_effect tfce_score; cd .. + if LIMO.design.tfce == 1 + load Yr; + if isfield(LIMO.data,'neighbouring_matrix') && size(Yr,1) > 1 && LIMO.design.bootstrap ~=0 + clear Yr; + if exist('TFCE','dir') + if strcmp(questdlg('TFCE directory detected, overwrite?','data check','Yes','No','No'),'No'); + return + end end - cd('H0'); fprintf('Creating H0 Condition(s) TFCE scores \n'); - for i=1:length(LIMO.design.nb_conditions) - name = sprintf('H0_Condition_effect_%g.mat',i); load(name); - tfce_H0_score(:,:,:) = limo_tfce(squeeze(H0_Condition_effect(:,:,1,:)),LIMO.data.neighbouring_matrix); - full_name = sprintf('tfce_%s',name); save(full_name,'tfce_H0_score'); - clear H0_Condition_effect tfce_H0_score; - end - cd .. - end - - % interactions - if LIMO.design.fullfactorial == 1 - for i=1:length(LIMO.design.fullfactorial) - name = sprintf('Interaction_effect_%g.mat',i); load(name); - cd('TFCE'); fprintf('Creating Interaction %g TFCE scores \n',i) - tfce_score = limo_tfce(squeeze(Interaction_effect(:,:,1)),LIMO.data.neighbouring_matrix); - full_name = sprintf('tfce_%s',name); save(full_name,'tfce_score'); - clear Interaction_effect tfce_score; cd .. - end + fprintf('\n %%%%%%%%%%%%%%%%%%%%%%%% \n Computing TFCE for GLM takes a while, be patient .. \n %%%%%%%%%%%%%%%%%%%%%%%% \n') + mkdir TFCE; + + % R2 + load R2.mat; fprintf('Creating R2 TFCE scores \n'); cd('TFCE'); + tfce_score = limo_tfce(squeeze(R2(:,:,2)),LIMO.data.neighbouring_matrix); + save('tfce_R2','tfce_score'); clear R2; cd ..; - cd('H0'); fprintf('Creating H0 Interaction(s) TFCE scores \n'); - for i=1:length(LIMO.design.fullfactorial) - name = sprintf('H0_Interaction_effect_%g.mat',i); load(name); - tfce_H0_score(:,:,:) = limo_tfce(squeeze(H0_Interaction_effect(:,:,1,:)),LIMO.data.neighbouring_matrix); - full_name = sprintf('tfce_%s',name); save(full_name,'tfce_H0_score'); - clear H0_Interaction_effect tfce_H0_score; + cd('H0'); fprintf('Thresholding H0_R2 using TFCE \n'); load H0_R2; + tfce_H0_score = limo_tfce(squeeze(H0_R2(:,:,2,:)),LIMO.data.neighbouring_matrix); + save('tfce_H0_R2','tfce_H0_score'); clear H0_R2; cd ..; + + % conditions + if prod(LIMO.design.nb_conditions) ~=0 + for i=1:length(LIMO.design.nb_conditions) + name = sprintf('Condition_effect_%g.mat',i); load(name); + cd('TFCE'); fprintf('Creating Condition %g TFCE scores \n',i) + tfce_score = limo_tfce(squeeze(Condition_effect(:,:,1)),LIMO.data.neighbouring_matrix); + full_name = sprintf('tfce_%s',name); save(full_name,'tfce_score'); + clear Condition_effect tfce_score; cd .. + end + + cd('H0'); fprintf('Creating H0 Condition(s) TFCE scores \n'); + for i=1:length(LIMO.design.nb_conditions) + name = sprintf('H0_Condition_effect_%g.mat',i); load(name); + tfce_H0_score(:,:,:) = limo_tfce(squeeze(H0_Condition_effect(:,:,1,:)),LIMO.data.neighbouring_matrix); + full_name = sprintf('tfce_%s',name); save(full_name,'tfce_H0_score'); + clear H0_Condition_effect tfce_H0_score; + end + cd .. end - cd .. - end - - % covariates / continuous regressors - if LIMO.design.nb_continuous ~=0 - for i=1:LIMO.design.nb_continuous - name = sprintf('Covariate_effect_%g.mat',i); load(name); - cd('TFCE'); fprintf('Creating Covariate %g TFCE scores \n',i); - tfce_score = limo_tfce(squeeze(Covariate_effect(:,:,1)),LIMO.data.neighbouring_matrix); - full_name = sprintf('tfce_%s',name); save(full_name,'tfce_score'); - clear Covariate_effect tfce_score; cd .. + + % interactions + if LIMO.design.fullfactorial == 1 + for i=1:length(LIMO.design.fullfactorial) + name = sprintf('Interaction_effect_%g.mat',i); load(name); + cd('TFCE'); fprintf('Creating Interaction %g TFCE scores \n',i) + tfce_score = limo_tfce(squeeze(Interaction_effect(:,:,1)),LIMO.data.neighbouring_matrix); + full_name = sprintf('tfce_%s',name); save(full_name,'tfce_score'); + clear Interaction_effect tfce_score; cd .. + end + + cd('H0'); fprintf('Creating H0 Interaction(s) TFCE scores \n'); + for i=1:length(LIMO.design.fullfactorial) + name = sprintf('H0_Interaction_effect_%g.mat',i); load(name); + tfce_H0_score(:,:,:) = limo_tfce(squeeze(H0_Interaction_effect(:,:,1,:)),LIMO.data.neighbouring_matrix); + full_name = sprintf('tfce_%s',name); save(full_name,'tfce_H0_score'); + clear H0_Interaction_effect tfce_H0_score; + end + cd .. end - cd('H0'); fprintf('Creating H0 Covariate(s) TFCE scores \n'); - for i=1:LIMO.design.nb_continuous - name = sprintf('H0_Covariate_effect_%g.mat',i); load(name); - tfce_H0_score(:,:,:) = limo_tfce(squeeze(H0_Covariate_effect(:,:,1,:)),LIMO.data.neighbouring_matrix); - full_name = sprintf('tfce_%s',name); save(full_name,'tfce_H0_score'); - clear H0_Covariate_effect tfce_H0_score + % covariates / continuous regressors + if LIMO.design.nb_continuous ~=0 + for i=1:LIMO.design.nb_continuous + name = sprintf('Covariate_effect_%g.mat',i); load(name); + cd('TFCE'); fprintf('Creating Covariate %g TFCE scores \n',i); + tfce_score = limo_tfce(squeeze(Covariate_effect(:,:,1)),LIMO.data.neighbouring_matrix); + full_name = sprintf('tfce_%s',name); save(full_name,'tfce_score'); + clear Covariate_effect tfce_score; cd .. + end + + cd('H0'); fprintf('Creating H0 Covariate(s) TFCE scores \n'); + for i=1:LIMO.design.nb_continuous + name = sprintf('H0_Covariate_effect_%g.mat',i); load(name); + tfce_H0_score(:,:,:) = limo_tfce(squeeze(H0_Covariate_effect(:,:,1,:)),LIMO.data.neighbouring_matrix); + full_name = sprintf('tfce_%s',name); save(full_name,'tfce_H0_score'); + clear H0_Covariate_effect tfce_H0_score + end + cd .. end - cd .. + elseif ~isfield(LIMO.data,'neighbouring_matrix') + disp('No TFCE performed, neighbourhood matrix missing') + elseif size(Yr,1) == 1 + disp('No TFCE performed, only 1 electrode') end - elseif ~isfield(LIMO.data,'neighbouring_matrix') - disp('No TFCE performed, neighbourhood matrix missing') - elseif size(Yr,1) == 1 - disp('No TFCE performed, only 1 electrode') end diff --git a/limo_eeg_tf.m b/limo_eeg_tf.m index 39f661a..ef84367 100644 --- a/limo_eeg_tf.m +++ b/limo_eeg_tf.m @@ -178,10 +178,10 @@ function limo_eeg_tf(varargin) % Save all tf data as 4D elec x freqs x times x trials save LIMO LIMO; - Yhat = limo_tf_4d_reshape(Yhat); save Yhat Yhat; - Res = limo_tf_4d_reshape(Res); save Res Res; - Betas = limo_tf_4d_reshape(Betas); save Betas Betas; - R2 = limo_tf_4d_reshape(R2); save R2 R2; + Yhat = limo_tf_4d_reshape(Yhat); save Yhat Yhat -v7.3; + Res = limo_tf_4d_reshape(Res); save Res Res -v7.3; + Betas = limo_tf_4d_reshape(Betas); save Betas Betas -v7.3; + R2 = limo_tf_4d_reshape(R2); save R2 R2 -v7.3; clear Yhat Res Betas R2 if prod(LIMO.design.nb_conditions) ~=0 diff --git a/limo_import_tf.m b/limo_import_tf.m index 48637c0..31d7ef3 100644 --- a/limo_import_tf.m +++ b/limo_import_tf.m @@ -102,7 +102,7 @@ function Import_data_set_Callback(hObject, eventdata, handles) cd(PathName) try - disp('Trying to load TF EEGLAB dataset. Please wait ...'); + disp('loading TF EEGLAB dataset. Please wait ...'); EEG=pop_loadset(FileName); handles.data_dir = PathName; handles.data = FileName; @@ -111,12 +111,11 @@ function Import_data_set_Callback(hObject, eventdata, handles) handles.end = EEG.xmax; handles.rate = EEG.srate; handles.dir = PathName; % update by default the working dir where the data are - - fprintf('Data set %s loaded',FileName); disp(' ') + fprintf('Data set %s loaded \n',FileName); if isfield(EEG.etc,'tf_path') == 1 handles.tf_dir = EEG.etc.tf_path; - else helpdlg('Please ensure this is a time-frequency dataset. See LIMO tf help.'); + else helpdlg('Please ensure this is a time-frequency dataset. Related information should be stored in EEG.etc - see help.'); end catch @@ -182,7 +181,7 @@ function ending_point_Callback(hObject, eventdata, handles) % Find a possible frequency bin close to the requested one [a1 ind] = min(abs(EEG.etc.tf_times-ending)); closest_ending = EEG.etc.tf_times(ind); - if hight ~= closest_ending + if ending ~= closest_ending helpdlg(['The closest time bin in this data is:',num2str(closest_ending),'ms -- and this is now selected']); end handles.end = closest_ending; @@ -477,7 +476,7 @@ function Done_Callback(hObject, eventdata, handles) warndlg2('The data associated to the .set were not found','missing data') [f,p,ind] = uigetfile('*.mat','pick up your time frequency data'); if ind == 0 - error('datafile not selected - LIMO EEG aborded') + errordlg2('datafile not selected - LIMO EEG aborded') end LIMO.data.tf_data_filepath = [p f]; end @@ -494,28 +493,28 @@ function Done_Callback(hObject, eventdata, handles) LIMO.analysis_flag = 3; % set defaults - take from 1:numel if trim not set -if handles.trim_lowf == 0 +if isempty(handles.trim_lowf) LIMO.data.trim_low_f = 1; else LIMO.data.trim_low_f = handles.trim_lowf; end -if handles.trim_highf == 0 +if isempty(handles.trim_highf) LIMO.data.trim_high_f = numel(EEG.etc.tf_freqs); else LIMO.data.trim_high_f = handles.trim_highf; end -if handles.trim1 == 0 +if isempty(handles.trim1) LIMO.data.trim1 = 1; else LIMO.data.trim1 = handles.trim1; end -if handles.trim2 == 0 +if isempty(handles.trim2) LIMO.data.trim2 = numel(EEG.etc.tf_times); else - LIMO.data.trim2 = handles.trim_hight; + LIMO.data.trim2 = handles.trim2; end if isempty(handles.dir)