Main Content

showconstr

(Not recommended) Display optimization constraint

Description

showconstr is not recommended. Use show instead.

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 OptimizationEquality object, OptimizationInequality object, or 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.

Version History

Introduced in R2017b

collapse all

R2019b: showconstr is not recommended

The showconstr function is not recommended. Instead, use show. The show function replaces showconstr and many other problem-based functions.

There are no plans to remove showconstr at this time.