This file is indexed.

/usr/share/doc/octave/octave.html/Creating-Structures.html is in octave-doc 4.2.2-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Creating Structures (GNU Octave)</title>

<meta name="description" content="Creating Structures (GNU Octave)">
<meta name="keywords" content="Creating Structures (GNU Octave)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Structures.html#Structures" rel="up" title="Structures">
<link href="Manipulating-Structures.html#Manipulating-Structures" rel="next" title="Manipulating Structures">
<link href="Structure-Arrays.html#Structure-Arrays" rel="prev" title="Structure Arrays">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<a name="Creating-Structures"></a>
<div class="header">
<p>
Next: <a href="Manipulating-Structures.html#Manipulating-Structures" accesskey="n" rel="next">Manipulating Structures</a>, Previous: <a href="Structure-Arrays.html#Structure-Arrays" accesskey="p" rel="prev">Structure Arrays</a>, Up: <a href="Structures.html#Structures" accesskey="u" rel="up">Structures</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Creating-Structures-1"></a>
<h4 class="subsection">6.1.3 Creating Structures</h4>
<a name="index-dynamic-naming"></a>

<p>Besides the index operator <code>&quot;.&quot;</code>, Octave can use dynamic naming
<code>&quot;(var)&quot;</code> or the <code>struct</code> function to create structures.  Dynamic
naming uses the string value of a variable as the field name.  For example:
</p>
<div class="example">
<pre class="example">a = &quot;field2&quot;;
x.a = 1;
x.(a) = 2;
x
     &rArr; x =
        {
          a =  1
          field2 =  2
        }
</pre></div>

<p>Dynamic indexing also allows you to use arbitrary strings, not merely
valid Octave identifiers (note that this does not work on <small>MATLAB</small>):
</p>
<div class="example">
<pre class="example">a = &quot;long field with spaces (and funny char$)&quot;;
x.a = 1;
x.(a) = 2;
x
     &rArr; x =
        {
          a =  1
          long field with spaces (and funny char$) =  2
        }
</pre></div>

<p>The warning id <code>Octave:language-extension</code> can be enabled to warn
about this usage.  See <a href="Issuing-Warnings.html#XREFwarning_005fids">warning_ids</a>.
</p>
<p>More realistically, all of the functions that operate on strings can be used
to build the correct field name before it is entered into the data structure.
</p>
<div class="example">
<pre class="example">names = [&quot;Bill&quot;; &quot;Mary&quot;; &quot;John&quot;];
ages  = [37; 26; 31];
for i = 1:rows (names)
  database.(names(i,:)) = ages(i);
endfor
database
     &rArr; database =
        {
          Bill =  37
          Mary =  26
          John =  31
        }
</pre></div>

<p>The third way to create structures is the <code>struct</code> command.  <code>struct</code>
takes pairs of arguments, where the first argument in the pair is the fieldname
to include in the structure and the second is a scalar or cell array,
representing the values to include in the structure or structure array.  For
example:
</p>
<div class="example">
<pre class="example">struct (&quot;field1&quot;, 1, &quot;field2&quot;, 2)
&rArr; ans =
      {
        field1 =  1
        field2 =  2
      }
</pre></div>

<p>If the values passed to <code>struct</code> are a mix of scalar and cell
arrays, then the scalar arguments are expanded to create a
structure array with a consistent dimension.  For example:
</p>
<div class="example">
<pre class="example">s = struct (&quot;field1&quot;, {1, &quot;one&quot;}, &quot;field2&quot;, {2, &quot;two&quot;},
        &quot;field3&quot;, 3);
s.field1
     &rArr;
        ans =  1
        ans = one

s.field2
     &rArr;
        ans =  2
        ans = two

s.field3
     &rArr;
        ans =  3
        ans =  3
</pre></div>

<p>If you want to create a struct which contains a cell array as an
individual field, you must wrap it in another cell array as shown in
the following example:
</p>
<div class="example">
<pre class="example">struct (&quot;field1&quot;, {{1, &quot;one&quot;}}, &quot;field2&quot;, 2)
     &rArr; ans =
        {
          field1 =

        {
          [1,1] =  1
          [1,2] = one
        }

          field2 =  2
        }
</pre></div>

<a name="XREFstruct"></a><dl>
<dt><a name="index-struct"></a>: <em><var>s</var> =</em> <strong>struct</strong> <em>()</em></dt>
<dt><a name="index-struct-1"></a>: <em><var>s</var> =</em> <strong>struct</strong> <em>(<var>field1</var>, <var>value1</var>, <var>field2</var>, <var>value2</var>, &hellip;)</em></dt>
<dt><a name="index-struct-2"></a>: <em><var>s</var> =</em> <strong>struct</strong> <em>(<var>obj</var>)</em></dt>
<dd>
<p>Create a scalar or array structure and initialize its values.
</p>
<p>The <var>field1</var>, <var>field2</var>, &hellip; variables are strings specifying the
names of the fields and the <var>value1</var>, <var>value2</var>, &hellip; variables
can be of any type.
</p>
<p>If the values are cell arrays, create a structure array and initialize its
values.  The dimensions of each cell array of values must match.  Singleton
cells and non-cell values are repeated so that they fill the entire array.
If the cells are empty, create an empty structure array with the specified
field names.
</p>
<p>If the argument is an object, return the underlying struct.
</p>
<p>Observe that the syntax is optimized for struct <strong>arrays</strong>.  Consider
the following examples:
</p>
<div class="example">
<pre class="example">struct (&quot;foo&quot;, 1)
  &rArr; scalar structure containing the fields:
    foo =  1

struct (&quot;foo&quot;, {})
  &rArr; 0x0 struct array containing the fields:
    foo

struct (&quot;foo&quot;, { {} })
  &rArr; scalar structure containing the fields:
    foo = {}(0x0)

struct (&quot;foo&quot;, {1, 2, 3})
  &rArr; 1x3 struct array containing the fields:
    foo

</pre></div>

<p>The first case is an ordinary scalar struct&mdash;one field, one value.  The
second produces an empty struct array with one field and no values, since
being passed an empty cell array of struct array values.  When the value is
a cell array containing a single entry, this becomes a scalar struct with
that single entry as the value of the field.  That single entry happens
to be an empty cell array.
</p>
<p>Finally, if the value is a non-scalar cell array, then <code>struct</code>
produces a struct <strong>array</strong>.
</p>
<p><strong>See also:</strong> <a href="Processing-Data-in-Cell-Arrays.html#XREFcell2struct">cell2struct</a>, <a href="Manipulating-Structures.html#XREFfieldnames">fieldnames</a>, <a href="Manipulating-Structures.html#XREFgetfield">getfield</a>, <a href="Manipulating-Structures.html#XREFsetfield">setfield</a>, <a href="Manipulating-Structures.html#XREFrmfield">rmfield</a>, <a href="Manipulating-Structures.html#XREFisfield">isfield</a>, <a href="Manipulating-Structures.html#XREForderfields">orderfields</a>, <a href="#XREFisstruct">isstruct</a>, <a href="Function-Application.html#XREFstructfun">structfun</a>.
</p></dd></dl>


<p>The function <code>isstruct</code> can be used to test if an object is a
structure or a structure array.
</p>
<a name="XREFisstruct"></a><dl>
<dt><a name="index-isstruct"></a>: <em></em> <strong>isstruct</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Return true if <var>x</var> is a structure or a structure array.
</p>
<p><strong>See also:</strong> <a href="Predicates-for-Numeric-Objects.html#XREFismatrix">ismatrix</a>, <a href="Basic-Usage-of-Cell-Arrays.html#XREFiscell">iscell</a>, <a href="Built_002din-Data-Types.html#XREFisa">isa</a>.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="Manipulating-Structures.html#Manipulating-Structures" accesskey="n" rel="next">Manipulating Structures</a>, Previous: <a href="Structure-Arrays.html#Structure-Arrays" accesskey="p" rel="prev">Structure Arrays</a>, Up: <a href="Structures.html#Structures" accesskey="u" rel="up">Structures</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>