This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

writebounds

Save description of variable bounds

Syntax

writebounds(var)
writebounds(var,filename)

Description

writebounds(var) saves a description of the variable bounds in a file named variable_bounds.txt. Here, variable is the Name property of var. The writebounds function overwrites any existing file.

example

writebounds(var,filename) saves a description of the variable bounds in a file named filename.

Examples

collapse all

Create an optimization variable and save its bounds to a file.

x = optimvar('x',10,4,'LowerBound',randi(8,10,4),...
    'UpperBound',10+randi(7,10,4),'Type','integer');
writebounds(x,'BoundFile.txt')

The contents of BoundFile.txt:

		7 <= x(1, 1) <= 14
		8 <= x(2, 1) <= 13
		2 <= x(3, 1) <= 16
		8 <= x(4, 1) <= 16
		6 <= x(5, 1) <= 12
		1 <= x(6, 1) <= 14
		3 <= x(7, 1) <= 14
		5 <= x(8, 1) <= 15
		8 <= x(9, 1) <= 15
		8 <= x(10, 1) <= 16
		2 <= x(1, 2) <= 12
		8 <= x(2, 2) <= 15
		8 <= x(3, 2) <= 15
		4 <= x(4, 2) <= 12
		7 <= x(5, 2) <= 11
		2 <= x(6, 2) <= 14
		4 <= x(7, 2) <= 17
		8 <= x(8, 2) <= 13
		7 <= x(9, 2) <= 15
		8 <= x(10, 2) <= 12
		6 <= x(1, 3) <= 16
		1 <= x(2, 3) <= 12
		7 <= x(3, 3) <= 14
		8 <= x(4, 3) <= 15
		6 <= x(5, 3) <= 17
		7 <= x(6, 3) <= 17
		6 <= x(7, 3) <= 14
		4 <= x(8, 3) <= 11
		6 <= x(9, 3) <= 12
		2 <= x(10, 3) <= 12
		6 <= x(1, 4) <= 16
		1 <= x(2, 4) <= 12
		3 <= x(3, 4) <= 16
		1 <= x(4, 4) <= 12
		1 <= x(5, 4) <= 17
		7 <= x(6, 4) <= 13
		6 <= x(7, 4) <= 12
		3 <= x(8, 4) <= 12
		8 <= x(9, 4) <= 15
		1 <= x(10, 4) <= 14

Input Arguments

collapse all

Optimization variable, specified as an OptimizationVariable object. Create var using optimvar.

Example: var = optimvar('var',4,6)

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 .txt.

Example: "../Notes/steel_stuff.txt"

Data Types: char | string

Tips

  • To obtain the writebounds information at the Command Window, use showbounds.

Introduced in R2017b