Home > matpower5.1 > @opt_model > get.m

get

PURPOSE ^

GET Returns the value of a field.

SYNOPSIS ^

function val = get(om, varargin)

DESCRIPTION ^

GET  Returns the value of a field.
   VAL = GET(OM, FIELD1, FIELD2, ...)

   Example:
       var_order = get(om, 'var', 'order');

   See also OPT_MODEL.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function val = get(om, varargin)
0002 %GET  Returns the value of a field.
0003 %   VAL = GET(OM, FIELD1, FIELD2, ...)
0004 %
0005 %   Example:
0006 %       var_order = get(om, 'var', 'order');
0007 %
0008 %   See also OPT_MODEL.
0009 
0010 %   MATPOWER
0011 %   Copyright (c) 2008-2015 by Power System Engineering Research Center (PSERC)
0012 %   by Ray Zimmerman, PSERC Cornell
0013 %
0014 %   $Id: get.m 2644 2015-03-11 19:34:22Z ray $
0015 %
0016 %   This file is part of MATPOWER.
0017 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0018 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0019 
0020 val = om;
0021 for k = 1:length(varargin)
0022     if ischar(varargin{k})
0023         val = val.(varargin{k});
0024     else
0025         val = val(varargin{k});
0026     end
0027 end

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005