function N = get_var_N(om, name)
%GET_VAR_N  Returns the number of vars.
%   N = get_var_N(om)       : total number of vars
%   N = get_var_N(om, name) : number of vars in named set

%   MATPOWER
%   $Id: get_var_N.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 < 2
    N = om.var.N;
else
    if isfield(om.var.idx.N, name)
        N = om.var.idx.N.(name);
    else
        N = 0;
    end
end
