-
Notifications
You must be signed in to change notification settings - Fork 7
Parameters
Mikhail Panko edited this page Aug 29, 2013
·
3 revisions
- Don’t use any numbers in code directly; turn them into parameters and define in the beginning of a script
- In functions requiring many parameter inputs (or where you expect the number of such inputs to grow in the future) opt to pass them as one structure instead of a list of individual parameters. This will make the code more readable and reduce the necessity for refactoring in the future
- Put all parameters which might be used by more than one function into one separate project parameter structure and pass it along to functions; initialize this project parameter structure in a separate function, e.g.
setParams()
An example of a project parameter structure in MATLAB:
params.session = 'SS130829';
params.dataType = 'spikes';
params.sorted = false;
params.numSpikes = 1000;
[sortedSpikes, params] = sortSpikes(unsortedSpikes, params);