Back to the main page.

Bug 502 - replace keyval by ft_getopt

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

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

At the moment the cfg option structure is handled differently from the key-value pairs cell array. I made an implementation of a helper function which allows us to handle them in the same way. The consequence is that keyval (and keyvalcheck) have to be replaced by ft_getopt/ft_checkopt. Once all modules/low-level functions are done, we can move on to the high level functions and replace the default handling of the cfg structure there as well. See also http://bugzilla.fcdonders.nl/show_bug.cgi?id=486


Eelke Spaak - 2011-08-02 11:14:38 +0200

I fixed this in plotting/ft_plot_vector.m (and added ft_getopt.m and binaries to plotting/private/).


Robert Oostenveld - 2011-10-08 13:57:59 +0200

the following script can be used to get started with the conversion grep -l keyval *.m > changelist for file in `cat changelist`; do sed s/'keyval('/'ft_getopt(varargin, '/g $file > out ; mv out $file; done for file in `cat changelist` ; do sed s/\'',.*varargin)'/\'')'/g $file > out ; mv out $file ; done


Robert Oostenveld - 2011-10-08 14:00:33 +0200

mbp> svn commit Sending plotting/ft_plot_box.m Sending plotting/ft_plot_dipole.m Sending plotting/ft_plot_headshape.m Sending plotting/ft_plot_lay.m Sending plotting/ft_plot_line.m Sending plotting/ft_plot_matrix.m Sending plotting/ft_plot_mesh.m Sending plotting/ft_plot_montage.m Sending plotting/ft_plot_ortho.m Sending plotting/ft_plot_sens.m Sending plotting/ft_plot_slice.m Sending plotting/ft_plot_text.m Sending plotting/ft_plot_topo.m Sending plotting/ft_plot_topo3d.m Sending plotting/ft_plot_vol.m Sending plotting/ft_select_box.m Sending plotting/ft_select_channel.m Sending plotting/ft_select_point.m Sending plotting/ft_select_point3d.m Sending plotting/ft_select_range.m Sending plotting/ft_select_voxel.m Sending plotting/ft_uilayout.m Transmitting file data ...................... Committed revision 4384.


Robert Oostenveld - 2011-10-08 14:04:50 +0200

mbp> svn commit ft_topoplotCC.m loreta2fieldtrip.m statistics_montecarlo.m Sending ft_topoplotCC.m Sending loreta2fieldtrip.m Sending statistics_montecarlo.m Transmitting file data ... Committed revision 4385. mbp>


Robert Oostenveld - 2011-10-08 14:07:32 +0200

Sending preproc/ft_preproc_slidingrange.m Transmitting file data . Committed revision 4386.


Robert Oostenveld - 2011-10-09 11:55:31 +0200

mbp> svn commit Sending utilities/ft_checkconfig.m Sending utilities/ft_checkdata.m Sending utilities/ft_datatype_comp.m Sending utilities/ft_datatype_freq.m Sending utilities/ft_datatype_mvar.m Sending utilities/ft_datatype_source.m Sending utilities/ft_datatype_spike.m Sending utilities/ft_datatype_timelock.m Sending utilities/ft_datatype_volume.m Sending utilities/ft_fetch_data.m Sending utilities/ft_selectdata.m Transmitting file data ........... Committed revision 4388.


Robert Oostenveld - 2011-10-09 12:50:10 +0200

mbp> svn commit Sending specest/ft_specest_convol.m Sending specest/ft_specest_hilbert.m Sending specest/ft_specest_mtmconvol.m Sending specest/ft_specest_mtmfft.m Sending specest/ft_specest_wavelet.m Transmitting file data ..... Committed revision 4393. See also bug #1024


Robert Oostenveld - 2011-10-12 12:05:19 +0200

manzana> svn commit Sending fileio/ft_filetype.m Sending fileio/ft_flush_data.m Sending fileio/ft_flush_event.m Sending fileio/ft_flush_header.m Sending fileio/ft_read_data.m Sending fileio/ft_read_event.m Sending fileio/ft_read_header.m Sending fileio/ft_read_headshape.m Sending fileio/ft_read_mri.m Sending fileio/ft_read_sens.m Sending fileio/ft_read_spike.m Sending fileio/ft_read_vol.m Sending fileio/ft_write_data.m Sending fileio/ft_write_event.m Sending fileio/ft_write_volume.m Sending fileio/private/channelposition.m Sending fileio/private/ft_datatype_vol.m Sending fileio/private/read_eeglabdata.m Sending fileio/private/read_eeglabevent.m Sending fileio/private/read_neuralynx_nev.m Sending fileio/private/read_neuroshare.m Sending fileio/private/read_nimh_cortex.m Sending fileio/private/read_plexon_nex.m Sending fileio/private/read_plexon_plx.m Sending fileio/private/read_shm_event.m Sending fileio/private/read_spike6mat_data.m Sending fileio/private/read_spmeeg_data.m Sending fileio/private/read_spmeeg_event.m Sending fileio/private/read_trigger.m Sending fileio/private/read_yokogawa_event.m Sending fileio/private/write_plexon_nex.m Transmitting file data ............................... Committed revision 4437.


Robert Oostenveld - 2011-10-12 12:22:24 +0200

I have also done fieldtrip/private and any other remaining files that used keyval. The only section which still uses keyval is inverse, but that is related to bug #208 and therefore postponed for the moment.


Robert Oostenveld - 2011-11-11 11:19:57 +0100

I closed all bugs that were recently resolved.