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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>containers.Map (GNU Octave (version 6.2.0))</title>
<meta name="description" content="containers.Map (GNU Octave (version 6.2.0))">
<meta name="keywords" content="containers.Map (GNU Octave (version 6.2.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<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="Processing-Data-in-Structures.html" rel="prev" title="Processing Data in Structures">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {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}
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">
<span id="containers_002eMap"></span><div class="header">
<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>
<span id="containers_002eMap-1"></span><h3 class="section">6.2 containers.Map</h3>
<span id="index-Map"></span>
<span id="index-key_002fvalue-store"></span>
<span id="index-hash-table"></span>
<span id="XREFcontainers_005fMap"></span><dl>
<dt id="index-containers_002eMap">: <em><var>m</var> =</em> <strong>containers.Map</strong> <em>()</em></dt>
<dt id="index-containers_002eMap-1">: <em><var>m</var> =</em> <strong>containers.Map</strong> <em>(<var>keys</var>, <var>vals</var>)</em></dt>
<dt id="index-containers_002eMap-2">: <em><var>m</var> =</em> <strong>containers.Map</strong> <em>(<var>keys</var>, <var>vals</var>, <code>"UniformValues"</code>, <var>is_uniform</var>)</em></dt>
<dt id="index-containers_002eMap-3">: <em><var>m</var> =</em> <strong>containers.Map</strong> <em>(<code>"KeyType"</code>, <var>kt</var>, <code>"ValueType"</code>, <var>vt</var>)</em></dt>
<dd>
<p>Create an object of the containers.Map class that stores a list of key/value
pairs.
</p>
<p><var>keys</var> is an array of <em>unique</em> keys for the map. The keys can be
numeric scalars or strings. The type for numeric keys may be one of
<code>"double"</code>, <code>"single"</code>, <code>"int32"</code>, <code>"uint32"</code>,
<code>"int64"</code>, or <code>"uint64"</code>. Other numeric or logical keys will
be converted to <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>vals</var> is an array of values for the map with the <em>same</em> number
of elements as <var>keys</var>.
</p>
<p>When called with no input arguments a default map is created with strings
as the key type and <code>"any"</code> as the value type.
</p>
<p>The <code>"UniformValues"</code> option specifies whether the values of
the map must be strictly of the same type. If <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>"KeyType"</code> and <code>"ValueType"</code> arguments, create
an empty map with the specified types. The inputs <var>kt</var> and <var>vt</var> are
the types for the keys and values of the map respectively. Allowed values
for <var>kt</var> are <code>"char"</code>, <code>"double"</code>, <code>"single"</code>,
<code>"int32"</code>, <code>"uint32"</code>, <code>"int64"</code>, <code>"uint64"</code>.
Allowed values for <var>vt</var> are <code>"any"</code>, <code>"char"</code>,
<code>"double"</code>, <code>"single"</code>, <code>"int32"</code>, <code>"uint32"</code>,
<code>"int64"</code>, <code>"uint64"</code>, <code>"logical"</code>.
</p>
<p>The return value <var>m</var> is an object of the containers.Map class.
</p>
<p><strong>See also:</strong> <a href="Creating-Structures.html#XREFstruct">struct</a>.
</p></dd></dl>
<hr>
<div class="header">
<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>
</body>
</html>
|