GET_USERDATA Used to retrieve values of user data. VAL = OM.GET_USERDATA(NAME) returns the value specified by the given name This function allows the user to retrieve any arbitrary data that was saved in the object for later use. This can be useful when using a user function to add variables, constraints, costs, etc. For example, suppose some special indexing is constructed when adding some variables or constraints. This indexing data can be stored and used later to "unpack" the results of the solved case. See also OPT_MODEL, SET_USERDATA.
0001 function rv = get_userdata(om, name) 0002 %GET_USERDATA Used to retrieve values of user data. 0003 % 0004 % VAL = OM.GET_USERDATA(NAME) returns the value specified by the given name 0005 % 0006 % This function allows the user to retrieve any arbitrary data that was 0007 % saved in the object for later use. This can be useful when using a user 0008 % function to add variables, constraints, costs, etc. For example, suppose 0009 % some special indexing is constructed when adding some variables or 0010 % constraints. This indexing data can be stored and used later to "unpack" 0011 % the results of the solved case. 0012 % 0013 % See also OPT_MODEL, SET_USERDATA. 0014 0015 % MATPOWER 0016 % Copyright (c) 2008-2017, Power Systems Engineering Research Center (PSERC) 0017 % by Ray Zimmerman, PSERC Cornell 0018 % 0019 % This file is part of MATPOWER. 0020 % Covered by the 3-clause BSD License (see LICENSE file for details). 0021 % See https://matpower.org for more info. 0022 0023 if isfield(om.userdata, name) 0024 rv = om.userdata.(name); 0025 else 0026 rv = []; 0027 end