Mercurial > octave-nkf
annotate doc/interpreter/data.txi @ 8817:03b7f618ab3d
include docstrings for new functions in the manual
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 19 Feb 2009 15:39:19 -0500 |
parents | fd42779a8428 |
children | eb63fbe60fab |
rev | line source |
---|---|
6778 | 1 @c Copyright (C) 1996, 1997, 2007 John W. Eaton |
7018 | 2 @c |
3 @c This file is part of Octave. | |
4 @c | |
5 @c Octave is free software; you can redistribute it and/or modify it | |
6 @c under the terms of the GNU General Public License as published by the | |
7 @c Free Software Foundation; either version 3 of the License, or (at | |
8 @c your option) any later version. | |
9 @c | |
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT | |
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 @c for more details. | |
14 @c | |
15 @c You should have received a copy of the GNU General Public License | |
16 @c along with Octave; see the file COPYING. If not, see | |
17 @c <http://www.gnu.org/licenses/>. | |
3294 | 18 |
4167 | 19 @node Data Types |
3294 | 20 @chapter Data Types |
21 @cindex data types | |
22 | |
23 All versions of Octave include a number of built-in data types, | |
6620 | 24 including real and complex scalars and matrices, character strings, |
25 a data structure type, and an array that can contain all data types. | |
3294 | 26 |
27 It is also possible to define new specialized data types by writing a | |
28 small amount of C++ code. On some systems, new data types can be loaded | |
29 dynamically while Octave is running, so it is not necessary to recompile | |
30 all of Octave just to add a new type. @xref{Dynamically Linked | |
3402 | 31 Functions}, for more information about Octave's dynamic linking |
3294 | 32 capabilities. @ref{User-defined Data Types} describes what you must do |
33 to define a new data type for Octave. | |
34 | |
3428 | 35 @DOCSTRING(typeinfo) |
36 | |
3294 | 37 @menu |
38 * Built-in Data Types:: | |
39 * User-defined Data Types:: | |
40 * Object Sizes:: | |
41 @end menu | |
42 | |
4167 | 43 @node Built-in Data Types |
3294 | 44 @section Built-in Data Types |
45 @cindex data types, built-in | |
46 @cindex built-in data types | |
47 | |
48 The standard built-in data types are real and complex scalars and | |
6620 | 49 matrices, ranges, character strings, a data structure type, and cell |
50 arrays. Additional built-in data types may be added in future versions. | |
51 If you need a specialized data type that is not currently provided as a | |
3294 | 52 built-in type, you are encouraged to write your own user-defined data |
53 type and contribute it for distribution in a future release of Octave. | |
54 | |
6620 | 55 The data type of a variable can be determined and changed through the |
56 use of the following functions. | |
57 | |
6550 | 58 @DOCSTRING(class) |
59 | |
60 @DOCSTRING(isa) | |
61 | |
62 @DOCSTRING(cast) | |
63 | |
6868 | 64 @DOCSTRING(typecast) |
65 | |
66 @DOCSTRING(swapbytes) | |
67 | |
3294 | 68 @menu |
69 * Numeric Objects:: | |
4169 | 70 * Missing Data:: |
3294 | 71 * String Objects:: |
72 * Data Structure Objects:: | |
6624 | 73 * Cell Array Objects:: |
3294 | 74 @end menu |
75 | |
4167 | 76 @node Numeric Objects |
3294 | 77 @subsection Numeric Objects |
78 @cindex numeric constant | |
79 @cindex numeric value | |
80 | |
6620 | 81 Octave's built-in numeric objects include real, complex, and integer |
82 scalars and matrices. All built-in floating point numeric data is | |
83 currently stored as double precision numbers. On systems that use the | |
84 IEEE floating point format, values in the range of approximately | |
3294 | 85 @iftex |
86 @tex | |
87 $2.2251\times10^{-308}$ to $1.7977\times10^{308}$ | |
88 @end tex | |
89 @end iftex | |
6620 | 90 @ifnottex |
3294 | 91 2.2251e-308 to 1.7977e+308 |
6620 | 92 @end ifnottex |
3294 | 93 can be stored, and the relative precision is approximately |
94 @iftex | |
95 @tex | |
96 $2.2204\times10^{-16}$. | |
97 @end tex | |
98 @end iftex | |
6620 | 99 @ifnottex |
3294 | 100 2.2204e-16. |
6620 | 101 @end ifnottex |
3294 | 102 The exact values are given by the variables @code{realmin}, |
103 @code{realmax}, and @code{eps}, respectively. | |
104 | |
105 Matrix objects can be of any size, and can be dynamically reshaped and | |
106 resized. It is easy to extract individual rows, columns, or submatrices | |
107 using a variety of powerful indexing features. @xref{Index Expressions}. | |
108 | |
109 @xref{Numeric Data Types}, for more information. | |
110 | |
4169 | 111 @node Missing Data |
112 @subsection Missing Data | |
113 @cindex missing data | |
114 | |
6620 | 115 It is possible to represent missing data explicitly in Octave using |
116 @code{NA} (short for ``Not Available''). Missing data can only be | |
117 represented when data is represented as floating point numbers. In this | |
118 case missing data is represented as a special case of the representation | |
119 of @code{NaN}. | |
120 | |
4169 | 121 @DOCSTRING(NA) |
122 | |
123 @DOCSTRING(isna) | |
124 | |
4167 | 125 @node String Objects |
3294 | 126 @subsection String Objects |
127 @cindex strings | |
128 @cindex character strings | |
129 @opindex " | |
130 @opindex ' | |
131 | |
132 A character string in Octave consists of a sequence of characters | |
133 enclosed in either double-quote or single-quote marks. Internally, | |
134 Octave currently stores strings as matrices of characters. All the | |
135 indexing operations that work for matrix objects also work for strings. | |
136 | |
137 @xref{Strings}, for more information. | |
138 | |
4167 | 139 @node Data Structure Objects |
3294 | 140 @subsection Data Structure Objects |
141 @cindex structures | |
142 @cindex data structures | |
143 | |
144 Octave's data structure type can help you to organize related objects of | |
145 different types. The current implementation uses an associative array | |
146 with indices limited to strings, but the syntax is more like C-style | |
147 structures. | |
148 | |
149 @xref{Data Structures}, for more information. | |
150 | |
6620 | 151 @node Cell Array Objects |
152 @subsection Cell Array Objects | |
153 @cindex cell arrays | |
154 | |
155 A Cell Array in Octave is general array that can hold any number of | |
156 different data types. | |
157 | |
158 @xref{Cell Arrays}, for more information. | |
159 | |
4167 | 160 @node User-defined Data Types |
3294 | 161 @section User-defined Data Types |
162 @cindex user-defined data types | |
163 @cindex data types, user-defined | |
164 | |
165 Someday I hope to expand this to include a complete description of | |
166 Octave's mechanism for managing user-defined data types. Until this | |
167 feature is documented here, you will have to make do by reading the code | |
168 in the @file{ov.h}, @file{ops.h}, and related files from Octave's | |
169 @file{src} directory. | |
170 | |
4167 | 171 @node Object Sizes |
3294 | 172 @section Object Sizes |
173 | |
174 The following functions allow you to determine the size of a variable or | |
175 expression. These functions are defined for all objects. They return | |
176 @minus{}1 when the operation doesn't make sense. For example, Octave's | |
177 data structure type doesn't have rows or columns, so the @code{rows} and | |
178 @code{columns} functions return @minus{}1 for structure arguments. | |
179 | |
6549 | 180 @DOCSTRING(ndims) |
181 | |
3373 | 182 @DOCSTRING(columns) |
3294 | 183 |
3373 | 184 @DOCSTRING(rows) |
3294 | 185 |
6549 | 186 @DOCSTRING(numel) |
187 | |
3373 | 188 @DOCSTRING(length) |
3294 | 189 |
3373 | 190 @DOCSTRING(size) |
3294 | 191 |
3373 | 192 @DOCSTRING(isempty) |
3294 | 193 |
8817
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
7018
diff
changeset
|
194 @DOCSTRING(isnull) |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
7018
diff
changeset
|
195 |
6549 | 196 @DOCSTRING(sizeof) |
197 | |
198 @DOCSTRING(size_equal) | |
6550 | 199 |
200 @DOCSTRING(squeeze) |