Main Content

showexpr

(Not recommended) Display optimization expression

Description

showexpr is not recommended. Use show instead.

example

showexpr(expr) displays the optimization expression expr at the MATLAB® Command Window.

Examples

collapse all

Create an optimization variable and an expression.

x = optimvar('x',3,3);
A = magic(3);
expr = sum(sum(A.*x));

Display the expression.

showexpr(expr)
  8*x(1, 1) + 3*x(2, 1) + 4*x(3, 1) + x(1, 2) + 5*x(2, 2) + 9*x(3, 2) + 6*x(1, 3) + 7*x(2, 3) + 2*x(3, 3)

Input Arguments

collapse all

Optimization expression, specified as an OptimizationExpression object.

Example: sum(sum(x))

Tips

  • For an expression that has many terms, use writeexpr to generate a text file containing the expression information.

Version History

Introduced in R2017b

collapse all

R2019b: showexpr is not recommended

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

There are no plans to remove showexpr at this time.