Home > matpower7.0 > extras > syngrid > lib > sgvm_varargin_parse.m

sgvm_varargin_parse

PURPOSE ^

SGVM_VARARGIN_PARSE parses VARARGIN inputs

SYNOPSIS ^

function var = sgvm_varargin_parse(vargs, str, default)

DESCRIPTION ^

SGVM_VARARGIN_PARSE parses VARARGIN inputs
   VAR = SGVM_VARARGIN_PARSE(VARGS, STR, DEFAULT)

   Assuming key-value pairs, SGVM_VARARGIN_PARSE searches for key STR.
   If STR is found in VARARGIN, the value in the subsequent index is
   returned in VAR. Otherwise the DEFAULT is used.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function var = sgvm_varargin_parse(vargs, str, default)
0002 %SGVM_VARARGIN_PARSE parses VARARGIN inputs
0003 %   VAR = SGVM_VARARGIN_PARSE(VARGS, STR, DEFAULT)
0004 %
0005 %   Assuming key-value pairs, SGVM_VARARGIN_PARSE searches for key STR.
0006 %   If STR is found in VARARGIN, the value in the subsequent index is
0007 %   returned in VAR. Otherwise the DEFAULT is used.
0008 
0009 %   SynGrid
0010 %   Copyright (c) 2018, Power Systems Engineering Research Center (PSERC)
0011 %   by Eran Schweitzer, Arizona State University
0012 %
0013 %   This file is part of SynGrid.
0014 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0015 
0016 idx = find(strcmp(vargs, str), 1);
0017 if ~isempty(idx)
0018     var = vargs{idx+1};
0019 else
0020     var = default;
0021 end

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005