%% Find Numeric Equivalents of Named Index Variables
% Create an optimization variable named colors that is indexed by the primary additive color names and the primary subtractive color names. Include 'black' and 'white' as additive color names and 'black' as a subtractive color name.

colors = optimvar('colors',["black","white","red","green","blue"],["cyan","magenta","yellow","black"]);

% Find the index numbers for the additive colors 'red' and 'black' and for the subtractive color 'black'.

[idxadd,idxsub] = findindex(colors,{'red','black'},{'black'})

% Copyright 2012 The MathWorks, Inc.