%% Create Optimization Expressions Indexed by Strings
% Create a string array of color names, and an optimization expression that is indexed by the color names.

strexp = ["red","green","blue","yellow"];
expr = optimexpr(strexp)

%
% You can use a cell array of character vectors instead of strings to get the same effect.

strexp = {'red','green','blue','yellow'};
expr = optimexpr(strexp)

%
% If strexp is 4-by-1 instead of 1-by-4, then expr is also 4-by-1:

strexp = ["red";"green";"blue";"yellow"];
expr = optimexpr(strexp)

% Copyright 2012 The MathWorks, Inc.