Assigns an index to a field that is named after given variable col = set_var_col_const(var_list); This is a generic mechanism for assigning an index to a field that is named after a variable in the variable list. This allows for scripts to index into data using names and saves the script author from having to do strmatch() lookups each time. See also: set_form_col_const.m for a fixed set of column IDs Copyright (c) 2007-2012 The Regents of the University of California All Rights Reserved Author: 01/26/07 Petr Janata
0001 function col = set_var_col_const(var_list) 0002 % Assigns an index to a field that is named after given variable 0003 % 0004 % col = set_var_col_const(var_list); 0005 % 0006 % This is a generic mechanism for assigning an index to a field that is named 0007 % after a variable in the variable list. This allows for scripts to index into 0008 % data using names and saves the script author from having to do strmatch() 0009 % lookups each time. 0010 % 0011 % See also: set_form_col_const.m for a fixed set of column IDs 0012 % 0013 % 0014 % Copyright (c) 2007-2012 The Regents of the University of California 0015 % All Rights Reserved 0016 % 0017 % Author: 0018 % 01/26/07 Petr Janata 0019 0020 for ivar = 1:length(var_list) 0021 col.(var_list{ivar}) = ivar; 0022 end