Skip to content

Commit

Permalink
functions/popfunc/pop_loadset.m
Browse files Browse the repository at this point in the history
fix issue associated with parsing file path
  • Loading branch information
arnodelorme committed May 12, 2021
1 parent 669bfac commit a99ae38
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion functions/popfunc/pop_loadset.m
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
end
else
EEG = checkoldformat(TMPVAR);
[ EEG.filepath EEG.filename ext ] = fileparts( g.filename );
[ EEG.filepath EEG.filename ext ] = fileparts( g.filename{ifile} );
EEG.filename = [ EEG.filename ext ];
if ~isfield( EEG, 'data')
error('pop_loadset(): not an EEG dataset file');
Expand Down
34 changes: 25 additions & 9 deletions functions/studyfunc/pop_precomp.m
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,17 @@
if (~set_ersp && ~set_itc )
set(findobj('parent', hdl,'tag', 'ersp_push'), 'enable', 'off');
set(findobj('parent', hdl,'tag', 'ersp_params'), 'enable', 'off');
set(findobj('parent', hdl,'tag', 'ersp_test'), 'enable', 'off');
set(findobj('parent', hdl,'tag', 'ersp_test'), 'enable', 'off');
else
set(findobj('parent', hdl,'tag', 'ersp_push'), 'enable', 'on');
set(findobj('parent', hdl,'tag', 'ersp_params'), 'enable', 'on');
set(findobj('parent', hdl,'tag', 'ersp_test'), 'enable', 'on');
if any([ ALLEEG.trials ] == 1)
warndlg2('Some datasets have only one trial, cannot compute ERPimages');
set(findobj('parent', hdl,'tag', 'itc_on'), 'value', 0);
set(findobj('parent', hdl,'tag', 'ersp_on'), 'value', 0);
else
set(findobj('parent', hdl,'tag', 'ersp_push'), 'enable', 'on');
set(findobj('parent', hdl,'tag', 'ersp_params'), 'enable', 'on');
set(findobj('parent', hdl,'tag', 'ersp_test'), 'enable', 'on');
end
end
userdat{5} = 0;
set(hdl, 'userdata',userdat);
Expand All @@ -328,9 +334,14 @@
case 'seterpimage'
set_spec = get(findobj('parent', hdl, 'tag', 'erpimage_on'), 'value');
if set_spec
set(findobj('parent', hdl,'tag', 'erpimage_push'), 'enable', 'on');
set(findobj('parent', hdl,'tag', 'erpimage_params'), 'enable', 'on');
set(findobj('parent', hdl,'tag', 'erpimage_test'), 'enable', 'on');
if any([ ALLEEG.trials ] == 1)
warndlg2('Some datasets have only one trial, cannot compute ERPimages');
set(findobj('parent', hdl,'tag', 'erpimage_on'), 'value', 0);
else
set(findobj('parent', hdl,'tag', 'erpimage_push'), 'enable', 'on');
set(findobj('parent', hdl,'tag', 'erpimage_params'), 'enable', 'on');
set(findobj('parent', hdl,'tag', 'erpimage_test'), 'enable', 'on');
end
else set(findobj('parent', hdl,'tag', 'erpimage_push'), 'enable', 'off');
set(findobj('parent', hdl,'tag', 'erpimage_params'), 'enable', 'off');
set(findobj('parent', hdl,'tag', 'erpimage_test'), 'enable', 'off');
Expand All @@ -339,8 +350,13 @@
case 'seterp'
set_erp = get(findobj('parent', hdl, 'tag', 'erp_on'), 'value');
if set_erp
set(findobj('parent', hdl,'tag', 'erp_text'), 'enable', 'on');
set(findobj('parent', hdl,'tag', 'erp_base'), 'enable', 'on');
if any([ ALLEEG.trials ] == 1)
warndlg2('Some datasets have only one trial, cannot compute ERPs');
set(findobj('parent', hdl,'tag', 'erp_on'), 'value', 0);
else
set(findobj('parent', hdl,'tag', 'erp_text'), 'enable', 'on');
set(findobj('parent', hdl,'tag', 'erp_base'), 'enable', 'on');
end
else set(findobj('parent', hdl,'tag', 'erp_text'), 'enable', 'off');
set(findobj('parent', hdl,'tag', 'erp_base'), 'enable', 'off');
end
Expand Down
3 changes: 3 additions & 0 deletions functions/studyfunc/std_readdata.m
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@
datasetInds = strmatch(subjectList{iSubj}, { STUDY.datasetinfo.subject }, 'exact');
compList = [];
polList = [];
if size(STUDY.cluster(opt.clusters).sets,2) ~= length(datasetInds)
error('Cannot process components from different ICA decomposition of the same subjects'); % sometimes different sessions
end
if isempty(opt.component)
for iDat = datasetInds(:)'
indSet = find(STUDY.cluster(opt.clusters).sets(1,:) == iDat); % each column contain info about the same subject so we many only consider the first row
Expand Down
12 changes: 10 additions & 2 deletions functions/studyfunc/std_readfile.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,26 @@
% then we need to call std_readfile several times and combine
% the results
% ------------------------------------------------------------
% compList = varargin{end};
% idxSeq = [find(compList==1) length(compList)];
% if length(fileBaseName) > 1
% for iFile = 1:length(fileBaseName)
% varargin{end} = compList(idxSeq(iFile):idxSeq(iFile+1)-1);
% [measureDataTmp{iFile}, parameters, measureRange1, measureRange2, eventsTmp{iFile}] = std_readfile(fileBaseName{iFile}, varargin{:});
% end
if length(fileBaseName) > 1
for iFile = 1:length(fileBaseName)
[measureDataTmp{iFile}, parameters, measureRange1, measureRange2, eventsTmp{iFile}] = std_readfile(fileBaseName{iFile}, varargin{:});
end

% combine arrays
measureData = measureDataTmp{1};
events = eventsTmp{1};
for iData = 2:length(measureDataTmp)
for iCell = 1:length(measureDataTmp{iData}(:))
if ~isempty(measureDataTmp{iData}{iCell})
if ndims(measureDataTmp{iData}{iCell}) == 2, measureData{iCell} = [ measureData{iCell} measureDataTmp{iData}{iCell} ];
elseif ndims(measureDataTmp{iData}{iCell}) == 2, measureData{iCell}(:, :, end+1:end+size(measureDataTmp{iData}{iCell},3)) = measureDataTmp{iData}{iCell};
elseif ndims(measureDataTmp{iData}{iCell}) == 3, measureData{iCell}(:, :, end+1:end+size(measureDataTmp{iData}{iCell},3)) = measureDataTmp{iData}{iCell};
end
end
end
Expand Down Expand Up @@ -135,7 +143,7 @@
'timelimits' 'real' [] []; % ERPimage, ERP, ERSP, ITC
'triallimits' 'real' [] []; % ERPimage only
'freqlimits' 'real' [] []; % SPEC, ERSP, ITC
'dataindices' 'integer' [] [] }, 'std_readdatafile');
'dataindices' 'integer' [] [] }, 'std_readfile');
if ischar(opt), error(opt); end

if ~isempty(opt.triallimits), opt.freqlimits = opt.triallimits; end
Expand Down

0 comments on commit a99ae38

Please sign in to comment.