Home > matpower7.1 > mp-opt-model > lib > @opt_model > varsets_cell2struct.m

varsets_cell2struct

PURPOSE ^

VARSETS_CELL2STRUCT Converts VARSETS from cell array to struct array.

SYNOPSIS ^

function vs = varsets_cell2struct(om, vs)

DESCRIPTION ^

VARSETS_CELL2STRUCT  Converts VARSETS from cell array to struct array.
   VARSETS = OM.VARSETS_CELL2STRUCT(VARSETS)

   Converts VARSETS from a cell array to a struct array, if necessary.

   See also VARSETS_LEN

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function vs = varsets_cell2struct(om, vs)
0002 %VARSETS_CELL2STRUCT  Converts VARSETS from cell array to struct array.
0003 %   VARSETS = OM.VARSETS_CELL2STRUCT(VARSETS)
0004 %
0005 %   Converts VARSETS from a cell array to a struct array, if necessary.
0006 %
0007 %   See also VARSETS_LEN
0008 
0009 %   MP-Opt-Model
0010 %   Copyright (c) 2017-2020, Power Systems Engineering Research Center (PSERC)
0011 %   by Ray Zimmerman, PSERC Cornell
0012 %
0013 %   This file is part of MP-Opt-Model.
0014 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0015 %   See https://github.com/MATPOWER/mp-opt-model for more info.
0016 
0017 %% convert varsets from cell to struct array if necessary
0018 if ~isempty(vs) && iscell(vs)
0019     empty_cells = cell(1, length(vs));
0020     [empty_cells{:}] = deal({});    %% empty cell arrays
0021     vs = struct('name', vs, 'idx', empty_cells);
0022 end

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005