<html lang="en"> <head> <title>Empty Matrices - 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="Matrices.html#Matrices" title="Matrices"> <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="Empty-Matrices"></a> <p> Up: <a rel="up" accesskey="u" href="Matrices.html#Matrices">Matrices</a> <hr> </div> <h4 class="subsection">4.1.1 Empty Matrices</h4> <p>A matrix may have one or both dimensions zero, and operations on empty matrices are handled as described by Carl de Boor in <cite>An Empty Exercise</cite>, SIGNUM, Volume 25, pages 2-6, 1990 and C. N. Nett and W. M. Haddad, in <cite>A System-Theoretic Appropriate Realization of the Empty Matrix Concept</cite>, IEEE Transactions on Automatic Control, Volume 38, Number 5, May 1993. Briefly, given a scalar <var>s</var>, an <var>m</var> by <var>n</var> matrix <code>M(mxn)</code>, and an <var>m</var> by <var>n</var> empty matrix <code>[](mxn)</code> (with either one or both dimensions equal to zero), the following are true: <pre class="example"> s * [](mxn) = [](mxn) * s = [](mxn) [](mxn) + [](mxn) = [](mxn) [](0xm) * M(mxn) = [](0xn) M(mxn) * [](nx0) = [](mx0) [](mx0) * [](0xn) = 0(mxn) </pre> <p>By default, dimensions of the empty matrix are printed along with the empty matrix symbol, ‘<samp><span class="samp">[]</span></samp>’. The built-in variable <code>print_empty_dimensions</code> controls this behavior. <!-- print_empty_dimensions src/pr-output.cc --> <p><a name="doc_002dprint_005fempty_005fdimensions"></a> <div class="defun"> — Built-in Function: <var>val</var> = <b>print_empty_dimensions</b> ()<var><a name="index-print_005fempty_005fdimensions-264"></a></var><br> — Built-in Function: <var>old_val</var> = <b>print_empty_dimensions</b> (<var>new_val</var>)<var><a name="index-print_005fempty_005fdimensions-265"></a></var><br> — Built-in Function: <b>print_empty_dimensions</b> (<var>new_val, "local"</var>)<var><a name="index-print_005fempty_005fdimensions-266"></a></var><br> <blockquote><p>Query or set the internal variable that controls whether the dimensions of empty matrices are printed along with the empty matrix symbol, ‘<samp><span class="samp">[]</span></samp>’. For example, the expression <pre class="example"> zeros (3, 0) </pre> <p class="noindent">will print <pre class="example"> ans = [](3x0) </pre> <p>When called from inside a function with the "local" option, the variable is changed locally for the function and any subroutines it calls. The original variable value is restored when exiting the function. <!-- 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_002dformat.html#doc_002dformat">format</a>. </p></blockquote></div> <p>Empty matrices may also be used in assignment statements as a convenient way to delete rows or columns of matrices. See <a href="Assignment-Ops.html#Assignment-Ops">Assignment Expressions</a>. <p>When Octave parses a matrix expression, it examines the elements of the list to determine whether they are all constants. If they are, it replaces the list with a single matrix constant. </body></html>