Back to the main page.

Bug 2719 - cfg.trials=[]; in ft_selectdata results in cfg.trials = 'all';

Reported 2014-10-02 16:31:00 +0200
Modified 2019-08-10 12:31:31 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 normal
Assigned to:
Depends on:
See also:

Jim Herring - 2014-10-02 16:31:43 +0200

During the NatMeg workshop we noticed that when cfg.trials is empty, it results in all trials being selected. The specific situation here was that cfg.trials=find(data.trialinfo(:,1)==trigger); did not result in any trials (due to a typo in the trigger number). However, all trials were selected. Perhaps it is better that ft_selectdata throws an error if cfg.trials is present, but empty.

Jan-Mathijs Schoffelen - 2014-10-02 16:59:27 +0200

ft_getopt has a flag that means 'ismeaningfullempty', allowing for an empty definition of e.g. cfg.trials to return no trials, rather than all. The old version of ft_selectdata supported this. Could you check whether the ismeaningfullempty flag is used in ft_getopt when setting the default for cfg.trials?

Robert Oostenveld - 2014-10-02 19:20:59 +0200

(In reply to Jan-Mathijs Schoffelen from comment #1) this should be checked in all code where cfg.trials is used

Jim Herring - 2014-10-03 10:41:21 +0200

emptymeaningful is not set in the functions I checked, I will fix it.

Jim Herring - 2015-01-19 14:39:44 +0100

I've set ismeaningfullempty to 1 for the following functions:'s password: Sending ft_channelrepair.m Sending ft_combineplanar.m Sending ft_componentanalysis.m Sending ft_connectivityanalysis.m Sending ft_denoise_pca.m Sending ft_freqanalysis.m Sending ft_freqdescriptives.m Sending ft_freqstatistics.m Sending ft_megplanar.m Sending ft_multiplotER.m Sending ft_multiplotTFR.m Sending ft_redefinetrial.m Sending ft_rejectvisual.m Sending ft_singleplotER.m Sending ft_singleplotTFR.m Sending ft_timelockanalysis.m Sending private/topoplot_common.m Transmitting file data ................. Committed revision 10105. ft_selectdata was already fixed so I might have done that one previously.

Robert Oostenveld - 2019-08-10 12:31:31 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on