Skip to content

Commit

Permalink
enhancement - use ft_selectdata 'new'
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.fcdonders.nl/home/svnroot/fieldtrip/trunk@10217 0cf7c7f0-3615-4144-b4e6-68da3bce3cd0
  • Loading branch information
schoffelen committed Feb 12, 2015
1 parent 438ebdf commit 59ca992
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
10 changes: 5 additions & 5 deletions ft_denoise_synthetic.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
cfg = ft_checkconfig(cfg, 'required', {'gradient'});

% set the defaults
if ~isfield(cfg, 'trials'), cfg.trials = 'all'; end
cfg.trials = ft_getopt(cfg, 'trials', 'all', 1);

% store the original type of the input data
dtype = ft_datatype(data);
Expand All @@ -81,10 +81,10 @@
end

% select trials of interest
if ~strcmp(cfg.trials, 'all')
fprintf('selecting %d trials\n', length(cfg.trials));
data = ft_selectdata(data, 'rpt', cfg.trials);
end
tmpcfg = keepfields(cfg, 'trials');
data = ft_selectdata(tmpcfg, data);
% restore the provenance information
[cfg, data] = rollback_provenance(cfg, data);

% remember the original channel ordering
labelorg = data.label;
Expand Down
9 changes: 5 additions & 4 deletions ft_preprocessing.m
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,13 @@
end

% set the defaults
if ~isfield(cfg, 'trials'), cfg.trials = 'all'; end
cfg.trials = ft_getopt(cfg, 'trials', 'all', 1);

% select trials of interest
if ~strcmp(cfg.trials, 'all')
data = ft_selectdata(data, 'rpt', cfg.trials);
end
tmpcfg = keepfields(cfg, 'trials');
data = ft_selectdata(tmpcfg, data);
% restore the provenance information
[cfg, data] = rollback_provenance(cfg, data);

% translate the channel groups (like 'all' and 'MEG') into real labels
cfg.channel = ft_channelselection(cfg.channel, data.label);
Expand Down
8 changes: 7 additions & 1 deletion ft_redefinetrial.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,13 @@
% select trials of interest
if ~strcmp(cfg.trials, 'all')
if fb, fprintf('selecting %d trials\n', length(cfg.trials)); end
data = ft_selectdata(data, 'rpt', cfg.trials);

% select trials of interest
tmpcfg = keepfields(cfg, 'trials');
data = ft_selectdata(tmpcfg, data);
% restore the provenance information
[cfg, data] = rollback_provenance(cfg, data);

if length(cfg.offset)>1 && length(cfg.offset)~=length(cfg.trials)
cfg.offset=cfg.offset(cfg.trials);
end
Expand Down

0 comments on commit 59ca992

Please sign in to comment.