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
|
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>containers.Map (GNU Octave (version 10.3.0))</title>
<meta name="description" content="containers.Map (GNU Octave (version 10.3.0))">
<meta name="keywords" content="containers.Map (GNU Octave (version 10.3.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Data-Containers.html" rel="up" title="Data Containers">
<link href="Cell-Arrays.html" rel="next" title="Cell Arrays">
<link href="Structures.html" rel="prev" title="Structures">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">
</head>
<body lang="en">
<div class="section-level-extent" id="containers_002eMap">
<div class="nav-panel">
<p>
Next: <a href="Cell-Arrays.html" accesskey="n" rel="next">Cell Arrays</a>, Previous: <a href="Structures.html" accesskey="p" rel="prev">Structures</a>, Up: <a href="Data-Containers.html" accesskey="u" rel="up">Data Containers</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="containers_002eMap-1"><span>6.2 containers.Map<a class="copiable-link" href="#containers_002eMap-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-Map"></a>
<a class="index-entry-id" id="index-key_002fvalue-store"></a>
<a class="index-entry-id" id="index-hash-table"></a>
<a class="anchor" id="XREFcontainers_005fMap"></a><span style="display:block; margin-top:-4.5ex;"> </span>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-containers_002eMap"><span><code class="def-type"><var class="var">m</var> =</code> <strong class="def-name">containers.Map</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-containers_002eMap"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-containers_002eMap-1"><span><code class="def-type"><var class="var">m</var> =</code> <strong class="def-name">containers.Map</strong> <code class="def-code-arguments">(<var class="var">keys</var>, <var class="var">vals</var>)</code><a class="copiable-link" href="#index-containers_002eMap-1"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-containers_002eMap-2"><span><code class="def-type"><var class="var">m</var> =</code> <strong class="def-name">containers.Map</strong> <code class="def-code-arguments">(<var class="var">keys</var>, <var class="var">vals</var>, <code class="code">"UniformValues"</code>, <var class="var">is_uniform</var>)</code><a class="copiable-link" href="#index-containers_002eMap-2"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-containers_002eMap-3"><span><code class="def-type"><var class="var">m</var> =</code> <strong class="def-name">containers.Map</strong> <code class="def-code-arguments">(<code class="code">"KeyType"</code>, <var class="var">kt</var>, <code class="code">"ValueType"</code>, <var class="var">vt</var>)</code><a class="copiable-link" href="#index-containers_002eMap-3"> ¶</a></span></dt>
<dd>
<p>Create an object of the containers.Map class that stores a list of
key/value pairs.
</p>
<p><var class="var">keys</var> is an array of <em class="emph">unique</em> keys for the map. The keys can be
numeric scalars or strings. The type for numeric keys may be one of
<code class="code">"double"</code>, <code class="code">"single"</code>, <code class="code">"int32"</code>, <code class="code">"uint32"</code>,
<code class="code">"int64"</code>, or <code class="code">"uint64"</code>. Other numeric or logical keys will
be converted to <code class="code">"double"</code>. A single string key may be entered as
is. Multiple string keys are entered as a cell array of strings.
</p>
<p><var class="var">vals</var> is an array of values for the map with the <em class="emph">same</em> number
of elements as <var class="var">keys</var>.
</p>
<p>When called with no input arguments, a default map is created with strings
as the key type and <code class="code">"any"</code> as the value type.
</p>
<p>The <code class="code">"UniformValues"</code> option specifies whether the values of the map
must be strictly of the same type. If <var class="var">is_uniform</var> is true, any
values which would be added to the map are first validated to ensure they
are of the correct type.
</p>
<p>When called with <code class="code">"KeyType"</code> and <code class="code">"ValueType"</code> arguments,
create an empty map with the specified types. The inputs <var class="var">kt</var> and
<var class="var">vt</var> are the types for the keys and values of the map, respectively.
Allowed values for <var class="var">kt</var> are <code class="code">"char"</code>, <code class="code">"double"</code>,
<code class="code">"single"</code>, <code class="code">"int32"</code>, <code class="code">"uint32"</code>, <code class="code">"int64"</code>,
<code class="code">"uint64"</code>. Allowed values for <var class="var">vt</var> are <code class="code">"any"</code>,
<code class="code">"char"</code>, <code class="code">"double"</code>, <code class="code">"single"</code>, <code class="code">"int32"</code>,
<code class="code">"uint32"</code>, <code class="code">"int64"</code>, <code class="code">"uint64"</code>, <code class="code">"logical"</code>.
</p>
<p>The return value <var class="var">m</var> is an object of the containers.Map class.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Creating-Structures.html#XREFstruct">struct</a>.
</p></dd></dl>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Cell-Arrays.html">Cell Arrays</a>, Previous: <a href="Structures.html">Structures</a>, Up: <a href="Data-Containers.html">Data Containers</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|