%% Create OptimizationEquality Array
% Create a 4-by-6 optimization variable matrix named x.

x = optimvar('x',4,6);

% Create the equalities that each row of x sums to one.

constrsum = sum(x,2) == 1

% View the equalities.

show(constrsum)

% To include the equalities in an optimization problem, set a Constraints property to constrsum by using dot notation.

prob = optimproblem;
prob.Constraints.constrsum = constrsum

% Similarly, to include the equalities in an equation problem, set a Constraints property to constrsum by using dot notation.

eqnprob = eqnproblem;
eqnprob.Equations.constrsum = constrsum

% Copyright 2019 The MathWorks, Inc.
%