12.07.2015 Views

GNU Octave - Local Sector 7 web page

GNU Octave - Local Sector 7 web page

GNU Octave - Local Sector 7 web page

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 4: Numeric Data Types 37Empty matrices may also be used in assignment statements as a convenient way to deleterows or columns of matrices. See Section 10.6 [Assignment Expressions], <strong>page</strong> 72.warn empty list elementsBuilt-in VariableIf the value of warn_empty_list_elements is nonzero, print a warning when anempty matrix is found in a matrix list. For example,a = [1, [], 3, [], 5]The default value is 0.When <strong>Octave</strong> parses a matrix expression, it examines the elements of the list to determinewhether they are all constants. If they are, it replaces the list with a single matrix constant.4.2 RangesA range is a convenient way to write a row vector with evenly spaced elements. A rangeexpression is defined by the value of the first element in the range, an optional value for theincrement between elements, and a maximum value which the elements of the range willnot exceed. The base, increment, and limit are separated by colons (the ‘:’ character) andmay contain any arithmetic expressions and function calls. If the increment is omitted, itis assumed to be 1. For example, the range1 : 5defines the set of values ‘[ 1, 2, 3, 4, 5 ]’, and the range1 : 3 : 5defines the set of values ‘[ 1, 4 ]’.Although a range constant specifies a row vector, <strong>Octave</strong> does not convert range constantsto vectors unless it is necessary to do so. This allows you to write a constant like ‘1: 10000’ without using 80,000 bytes of storage on a typical 32-bit workstation.Note that the upper (or lower, if the increment is negative) bound on the range is notalways included in the set of values, and that ranges defined by floating point values canproduce surprising results because <strong>Octave</strong> uses floating point arithmetic to compute thevalues in the range. If it is important to include the endpoints of a range and the number ofelements is known, you should use the linspace function instead (see Section 18.3 [SpecialUtility Matrices], <strong>page</strong> 156).When <strong>Octave</strong> parses a range expression, it examines the elements of the expression todetermine whether they are all constants. If they are, it replaces the range expression witha single range constant.4.3 Logical ValuestrueLogical true value.Built-in VariablefalseLogical false value.Built-in Variable

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!