Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > b38d2da330d1936e5ab1307c039c4941 > files > 496

octave-doc-3.6.4-3.mga4.noarch.rpm

<html lang="en">
<head>
<title>Terminal Output - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Basic-Input-and-Output.html#Basic-Input-and-Output" title="Basic Input and Output">
<link rel="next" href="Terminal-Input.html#Terminal-Input" title="Terminal Input">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Terminal-Output"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Terminal-Input.html#Terminal-Input">Terminal Input</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Basic-Input-and-Output.html#Basic-Input-and-Output">Basic Input and Output</a>
<hr>
</div>

<h4 class="subsection">14.1.1 Terminal Output</h4>

<p>Since Octave normally prints the value of an expression as soon as it
has been evaluated, the simplest of all I/O functions is a simple
expression.  For example, the following expression will display the
value of &lsquo;<samp><span class="samp">pi</span></samp>&rsquo;

<pre class="example">     pi
          -| pi = 3.1416
</pre>
   <p>This works well as long as it is acceptable to have the name of the
variable (or &lsquo;<samp><span class="samp">ans</span></samp>&rsquo;) printed along with the value.  To print the
value of a variable without printing its name, use the function
<code>disp</code>.

   <p>The <code>format</code> command offers some control over the way Octave prints
values with <code>disp</code> and through the normal echoing mechanism.

<!-- disp src/pr-output.cc -->
   <p><a name="doc_002ddisp"></a>

<div class="defun">
&mdash; Built-in Function:  <b>disp</b> (<var>x</var>)<var><a name="index-disp-879"></a></var><br>
<blockquote><p>Display the value of <var>x</var>.  For example:

     <pre class="example">          disp ("The value of pi is:"), disp (pi)
          
               -| the value of pi is:
               -| 3.1416
</pre>
        <p class="noindent">Note that the output from <code>disp</code> always ends with a newline.

        <p>If an output value is requested, <code>disp</code> prints nothing and
returns the formatted output in a string. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dfdisp.html#doc_002dfdisp">fdisp</a>. 
</p></blockquote></div>

<!-- list_in_columns src/strfns.cc -->
   <p><a name="doc_002dlist_005fin_005fcolumns"></a>

<div class="defun">
&mdash; Built-in Function:  <b>list_in_columns</b> (<var>arg, width</var>)<var><a name="index-list_005fin_005fcolumns-880"></a></var><br>
<blockquote><p>Return a string containing the elements of <var>arg</var> listed in
columns with an overall maximum width of <var>width</var>.  The argument
<var>arg</var> must be a cell array of character strings or a character array. 
If <var>width</var> is not specified, the width of the terminal screen is used. 
Newline characters are used to break the lines in the output string. 
For example:
<!-- Set example in small font to prevent overfull line -->

     <pre class="smallexample">          list_in_columns ({"abc", "def", "ghijkl", "mnop", "qrs", "tuv"}, 20)
               &rArr; ans = abc     mnop
                      def     qrs
                      ghijkl  tuv
          
          whos ans
               &rArr;
               Variables in the current scope:
          
                 Attr Name        Size                     Bytes  Class
                 ==== ====        ====                     =====  =====
                      ans         1x37                        37  char
          
               Total is 37 elements using 37 bytes
</pre>
        <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dterminal_005fsize.html#doc_002dterminal_005fsize">terminal_size</a>. 
</p></blockquote></div>

<!-- terminal_size src/pager.cc -->
   <p><a name="doc_002dterminal_005fsize"></a>

<div class="defun">
&mdash; Built-in Function:  <b>terminal_size</b> ()<var><a name="index-terminal_005fsize-881"></a></var><br>
<blockquote><p>Return a two-element row vector containing the current size of the
terminal window in characters (rows and columns). 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dlist_005fin_005fcolumns.html#doc_002dlist_005fin_005fcolumns">list_in_columns</a>. 
</p></blockquote></div>

<!-- format src/pr-output.cc -->
   <p><a name="doc_002dformat"></a>

<div class="defun">
&mdash; Command:  <b>format</b><var><a name="index-format-882"></a></var><br>
&mdash; Command:  <b>format</b><var> options<a name="index-format-883"></a></var><br>
<blockquote><p>Reset or specify the format of the output produced by <code>disp</code> and
Octave's normal echoing mechanism.  This command only affects the display
of numbers but not how they are stored or computed.  To change the internal
representation from the default double use one of the conversion functions
such as <code>single</code>, <code>uint8</code>, <code>int64</code>, etc.

        <p>By default, Octave displays 5 significant digits in a human readable form
(option &lsquo;<samp><span class="samp">short</span></samp>&rsquo; paired with &lsquo;<samp><span class="samp">loose</span></samp>&rsquo; format for matrices). 
If <code>format</code> is invoked without any options, this default format
is restored.

        <p>Valid formats for floating point numbers are listed in the following
table.

          <dl>
<dt><code>short</code><dd>Fixed point format with 5 significant figures in a field that is a maximum
of 10 characters wide.  (default).

          <p>If Octave is unable to format a matrix so that columns line up on the
decimal point and all numbers fit within the maximum field width then
it switches to an exponential &lsquo;<samp><span class="samp">e</span></samp>&rsquo; format.

          <br><dt><code>long</code><dd>Fixed point format with 15 significant figures in a field that is a maximum
of 20 characters wide.

          <p>As with the &lsquo;<samp><span class="samp">short</span></samp>&rsquo; format, Octave will switch to an exponential
&lsquo;<samp><span class="samp">e</span></samp>&rsquo; format if it is unable to format a matrix properly using the
current format.

          <br><dt><code>short e</code><dt><code>long e</code><dd>Exponential format.  The number to be represented is split between a mantissa
and an exponent (power of 10).  The mantissa has 5 significant digits in the
short format and 15 digits in the long format. 
For example, with the &lsquo;<samp><span class="samp">short e</span></samp>&rsquo; format, <code>pi</code> is displayed as
<code>3.1416e+00</code>.

          <br><dt><code>short E</code><dt><code>long E</code><dd>Identical to &lsquo;<samp><span class="samp">short e</span></samp>&rsquo; or &lsquo;<samp><span class="samp">long e</span></samp>&rsquo; but displays an uppercase
&lsquo;<samp><span class="samp">E</span></samp>&rsquo; to indicate the exponent. 
For example, with the &lsquo;<samp><span class="samp">long E</span></samp>&rsquo; format, <code>pi</code> is displayed as
<code>3.14159265358979E+00</code>.

          <br><dt><code>short g</code><dt><code>long g</code><dd>Optimally choose between fixed point and exponential format based on
the magnitude of the number. 
For example, with the &lsquo;<samp><span class="samp">short g</span></samp>&rsquo; format,
<code>pi .^ [2; 4; 8; 16; 32]</code> is displayed as

          <pre class="example">               ans =
               
                     9.8696
                     97.409
                     9488.5
                 9.0032e+07
                 8.1058e+15
</pre>
          <br><dt><code>short eng</code><dt><code>long eng</code><dd>Identical to &lsquo;<samp><span class="samp">short e</span></samp>&rsquo; or &lsquo;<samp><span class="samp">long e</span></samp>&rsquo; but displays the value
using an engineering format, where the exponent is divisible by 3. For
example, with the &lsquo;<samp><span class="samp">short eng</span></samp>&rsquo; format, <code>10 * pi</code> is displayed as
<code>31.4159e+00</code>.

          <br><dt><code>long G</code><dt><code>short G</code><dd>Identical to &lsquo;<samp><span class="samp">short g</span></samp>&rsquo; or &lsquo;<samp><span class="samp">long g</span></samp>&rsquo; but displays an uppercase
&lsquo;<samp><span class="samp">E</span></samp>&rsquo; to indicate the exponent.

          <br><dt><code>free</code><dt><code>none</code><dd>Print output in free format, without trying to line up columns of
matrices on the decimal point.  This also causes complex numbers to be
formatted as numeric pairs like this &lsquo;<samp><span class="samp">(0.60419, 0.60709)</span></samp>&rsquo; instead
of like this &lsquo;<samp><span class="samp">0.60419 + 0.60709i</span></samp>&rsquo;. 
</dl>

        <p>The following formats affect all numeric output (floating point and
integer types).

          <dl>
<dt><code>+</code><dt><code>+ </code><var>chars</var><dt><code>plus</code><dt><code>plus </code><var>chars</var><dd>Print a &lsquo;<samp><span class="samp">+</span></samp>&rsquo; symbol for nonzero matrix elements and a space for zero
matrix elements.  This format can be very useful for examining the
structure of a large sparse matrix.

          <p>The optional argument <var>chars</var> specifies a list of 3 characters to use
for printing values greater than zero, less than zero and equal to zero. 
For example, with the &lsquo;<samp><span class="samp">+ "+-."</span></samp>&rsquo; format, <code>[1, 0, -1; -1, 0, 1]</code>
is displayed as

          <pre class="example">               ans =
               
               +.-
               -.+
</pre>
          <br><dt><code>bank</code><dd>Print in a fixed format with two digits to the right of the decimal
point.

          <br><dt><code>native-hex</code><dd>Print the hexadecimal representation of numbers as they are stored in
memory.  For example, on a workstation which stores 8 byte real values
in IEEE format with the least significant byte first, the value of
<code>pi</code> when printed in <code>native-hex</code> format is
<code>400921fb54442d18</code>.

          <br><dt><code>hex</code><dd>The same as <code>native-hex</code>, but always print the most significant
byte first.

          <br><dt><code>native-bit</code><dd>Print the bit representation of numbers as stored in memory. 
For example, the value of <code>pi</code> is

          <pre class="example">               01000000000010010010000111111011
               01010100010001000010110100011000
</pre>
          <p>(shown here in two 32 bit sections for typesetting purposes) when
printed in native-bit format on a workstation which stores 8 byte real values
in IEEE format with the least significant byte first.

          <br><dt><code>bit</code><dd>The same as <code>native-bit</code>, but always print the most significant
bits first.

          <br><dt><code>rat</code><dd>Print a rational approximation, i.e., values are approximated
as the ratio of small integers. 
For example, with the &lsquo;<samp><span class="samp">rat</span></samp>&rsquo; format,
<code>pi</code> is displayed as <code>355/113</code>. 
</dl>

        <p>The following two options affect the display of all matrices.

          <dl>
<dt><code>compact</code><dd>Remove blank lines around column number labels and between
matrices producing more compact output with more data per page.

          <br><dt><code>loose</code><dd>Insert blank lines above and below column number labels and between matrices
to produce a more readable output with less data per page.  (default). 
</dl>
        <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dfixed_005fpoint_005fformat.html#doc_002dfixed_005fpoint_005fformat">fixed_point_format</a>, <a href="doc_002doutput_005fmax_005ffield_005fwidth.html#doc_002doutput_005fmax_005ffield_005fwidth">output_max_field_width</a>, <a href="doc_002doutput_005fprecision.html#doc_002doutput_005fprecision">output_precision</a>, <a href="doc_002dsplit_005flong_005frows.html#doc_002dsplit_005flong_005frows">split_long_rows</a>, <a href="doc_002drats.html#doc_002drats">rats</a>. 
</p></blockquote></div>

<ul class="menu">
<li><a accesskey="1" href="Paging-Screen-Output.html#Paging-Screen-Output">Paging Screen Output</a>
</ul>

   </body></html>