Home > matpower7.0 > 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 %   MATPOWER
0010 %   Copyright (c) 2017, Power Systems Engineering Research Center (PSERC)
0011 %   by Ray Zimmerman, PSERC Cornell
0012 %
0013 %   This file is part of MATPOWER.
0014 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0015 %   See https://matpower.org 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 Mon 24-Jun-2019 15:58:45 by m2html © 2005