Back to the main page.

Bug 486 - implement getopt, setopt and checkopt fiunctions

Status CLOSED FIXED
Reported 2011-02-10 11:44:00 +0100
Modified 2011-02-23 13:51:02 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on: 298
Blocks:
See also:

Robert Oostenveld - 2011-02-10 11:44:07 +0100

it is desired to have more consistent and clean input cfg parsing. This can be combined with the keyval function. imagine opt = ft_setopt(opt, key, value) opt = ft_checkopt(opt, key, allowedtype, allowedval) val = ft_getopt(opt, key, default) where opt is either a cfg struct or a keyval cell array. In checkopt the allowedtype would be char, cell, double, struct, doublevector, doublematrix, charcell, ... where "isa" would be used for the default types and where custom types could be added on top of that. Multiple options are possible in a cell-array. Translation for simple types should be possible, e.g. the type 'boolean' should translate yes/no to true/false (replaces istrue). the allowedval would be a cell-array and the check would be a simple ismember call.


Robert Oostenveld - 2011-02-13 10:57:59 +0100

we should consider also making a mex implementation of ft_getopt to speed it up


Robert Oostenveld - 2011-02-13 10:58:22 +0100

(In reply to comment #1) > we should consider also making a mex implementation of ft_getopt to speed it up See http://bugzilla.fcdonders.nl/show_bug.cgi?id=486 and the preliminary mex file that Stefan already made


Robert Oostenveld - 2011-02-21 17:54:03 +0100

manzana> svn commit Sending utilities/ft_getopt.m Adding utilities/ft_setopt.m Transmitting file data .. Committed revision 2917.


Robert Oostenveld - 2011-02-21 22:48:32 +0100

the implementation is complete in revision 2922, which means that keyval and companions can be replaced.


Robert Oostenveld - 2011-02-23 13:51:02 +0100

I closed all bugs that were in the RESOLVED/FIXED or otherwise RESOLVED state.