function rv = userdata(om, name, val)
%USERDATA  Used to save or retrieve values of user data.
%
%   om = userdata(om, name, val) saves the value under the given name.
%   val = userdata(om, name) returns the value specified by the given name
%
%   This function allows the user to save any arbitrary data 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.

%   MATPOWER
%   $Id: userdata.m,v 1.2 2009/11/04 15:58:44 ray Exp $
%   by Ray Zimmerman, PSERC Cornell
%   Copyright (c) 2008 by Power System Engineering Research Center (PSERC)
%   See http://www.pserc.cornell.edu/matpower/ for more info.

if nargin == 3
	om.userdata.(name) = val;
	rv = om;
else
	rv = om.userdata.(name);
end
