Save optimization object description
write to save the description of an optimization
write( saves a description of the
obj in a file named
obj is the workspace variable name of the optimization object.
write cannot construct the file name from the expression, it writes
the description to
overwrites any existing file. If the object description is small, consider using
show instead to
display the description at the command line.
Save Expression Description
Create an optimization variable and an expression that uses the variable. Save a description of the expression to a file.
x = optimvar('x',3,3); A = magic(3); var = sum(sum(A.*x)); write(var)
write creates a file named
var.txt in the
current folder. The file contains the following text:
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)
Save the expression in a file named
'VarExpression.txt' in the
VarExpression.txt file contains the same text as
obj — Optimization object
OptimizationProblem object |
EquationProblem object |
OptimizationExpression object |
OptimizationVariable object |
OptimizationConstraint object |
OptimizationEquality object |
Optimization object, specified as one of the following:
write(obj)saves a file containing the variables for the solution, objective function, constraints, and variable bounds.
write(obj)saves a file containing the variables for the solution, equations for the solution, and variable bounds.
write(obj)saves a file containing the optimization expression.
write(obj)saves a file containing the optimization variables. The saved description does not indicate variable types or bounds; it includes only the variable dimensions and index names (if any).
write(obj)saves a file containing the constraint expression.
write(obj)saves a file containing the equality expression.
write(obj)saves a file containing the inequality expression.
filename — Path to file
string | character
Path to the file, specified as a string or character vector. The path is relative to the
current folder. The resulting file is a text file, so the file
name typically has the extension
Introduced in R2019b