%% Find Linear Index 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 linear index equivalents to the combinations ["white","black"], ["red","cyan"], ["green","magenta"], and ["blue","yellow"].

idx = findindex(colors,["white","red","green","blue"],["black","cyan","magenta","yellow"])

% Copyright 2012 The MathWorks, Inc.