Back to the main page.
Bug 2394 - ft_selectdata (_old and _new) does not deal consistently with selecting 0 trials
Status | CLOSED FIXED |
Reported | 2013-11-28 10:43:00 +0100 |
Modified | 2014-01-15 14:49:00 +0100 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Windows |
Importance: | P3 normal |
Assigned to: | Jan-Mathijs Schoffelen |
URL: | |
Tags: | |
Depends on: | |
Blocks: | 971021 |
See also: |
Eelke Spaak - 2013-11-28 10:43:37 +0100
Will make and commit test script soon. Four cases: selecting 0 trials with logical/numeric indexing, using _old or _new. _old fails both with logical and numeric indexing, _new fails only with numeric indexing.
Eelke Spaak - 2013-11-28 10:51:09 +0100
Added test script. bash-4.1$ svn commit test/test_bug2394.m Adding test/test_bug2394.m Transmitting file data . Committed revision 8873.
Jan-Mathijs Schoffelen - 2013-11-28 11:29:36 +0100
I am in the process of deprecating ft_selectdata_old, so the discrepancy between the two will become irrelevant, and I don't want to spend time in updating ft_selectdata_old. How do you numerically index zero trials?
Eelke Spaak - 2013-11-28 11:32:03 +0100
(In reply to comment #2) Agreed, we can forget about _old. It's just that I encountered the bug while using that one (but have now switched to _new). I also started out with logical indexing (finding the bug). Then I switched to numerical indexing, simply by wrapping the logical with a find() before passing on to ft_selectdata. This as the introduction to: numerically indexing 0 trials would be passing []. Reopening as _new fails in this case.
Jan-Mathijs Schoffelen - 2013-11-28 11:36:22 +0100
what's the datatype in the input? For me it works, but I can imagine that it does not work for 'raw', because I forgot to commit a change to selfromraw (just did so in r.8874). Could you close the bug if it now works?
Eelke Spaak - 2013-11-28 11:38:56 +0100
Yep, works now. I will change the test script to only check _new, and add an error to _old in case someone specifies [] or false(N,1), just to be sure no one gets weird results (it gave me a hard time for a few hours :) ).