showconstr

Display optimization constraint

Syntax

showconstr(constr)

Description

example

showconstr(constr) displays the optimization constraint constr at the MATLAB®Command Window.

Examples

collapse all

Display an array of optimization constraints.

x = optimvar('x',3,2);
constr = sum(x,2) <= [1;3;2];
showconstr(constr)
(1, 1)

  x(1, 1) + x(1, 2) <= 1

(2, 1)

  x(2, 1) + x(2, 2) <= 3

(3, 1)

  x(3, 1) + x(3, 2) <= 2

Input Arguments

collapse all

Optimization constraint, specified as an OptimizationConstraint object. constr can represent a single constraint or an array of constraints.

Example: constr = x + y <= 1 is a single constraint when x and y are scalar variables.

Example: constr = sum(x) == 1 is an array of constraints when x is an array of two or more dimensions.

Tips

  • For a large or complicated constraint, use writeconstr to generate a text file containing the constraint information.

Introduced in R2017b