MATLAB Programming Fundamentals - MathWorks
h1 = @(x)A * x.^2; h2 = h1; isequal(h1,h2) ans = logical 1 Compare Handles to Nested Functions MATLAB considers function handles ...
[q1,q2] = test_eq(4,19,-7); isequal(h1,q1) ans = logical 0 See Also isequal Related Examples “Create Function Handle” on page 1 ...
Map Containers “Overview of Map Data Structure” on page 14-2 “Description of Map Class” on page 14-4 “Create Map Object” on pag ...
Overview of Map Data Structure A Map is a type of fast key lookup data structure that offers a flexible means of indexing into i ...
The values stored in a Map can be of any type. This includes arrays of numeric values, structures, cells, character arrays, obje ...
Description of Map Class A Map is actually an object, or instance, of a MATLAB class called Map. It is also a handle object and, ...
Methods of Map Class The Map class implements the following methods. Their use is explained in the later sections of this docume ...
Create Map Object A Map is an object of the Map class. It is defined within a MATLAB package called containers. As with any clas ...
mapObj = containers.Map({key1, key2, ...}, {val1, val2, ...}); For those keys and values that are character vectors, be sure tha ...
Count: 13 KeyType: char ValueType: double The Count property is now set to the number of key/value pairs in the Map, 13 , the Ke ...
Examine Contents of Map Each entry in a Map consists of two parts: a unique key and its corresponding value. To find all the key ...
See Also containers.Map | isKey | keys | length | remove | size | values Related Examples “Create Map Object” on page 14-6 “Rea ...
Read and Write Using Key Index When reading from the Map, use the same keys that you have defined and associated with particular ...
To access the values of multiple keys, use the values method, specifying the keys in a cell array: values(ticketMap, {'2R175', ' ...
List all of the keys and values in ticketMap: keys(ticketMap), values(ticketMap) ans = '2R175' '417R93' '947F4' 'A479GY' 'B7398' ...
ans = '2R175' '417R93' '947F4' 'A479GY' 'B7398' 'NZ1452' ans = 'James Enright' 'Patricia Hughes' 'Susan Spera' 'Sarah Latham' 'C ...
“Modify Keys and Values in Map” on page 14-16 “Map to Different Value Types” on page 14-19 See Also ...
Modify Keys and Values in Map NoteKeep in mind that if you have more than one handle to a Map, modifying the handle also makes c ...
Sarah Latham Change the passenger's first name to Anna Latham by overwriting the original value for the A479GY key: ticketMap('A ...
Make a copy of the ticketMap Map. Write to this copy, and notice that the change is applied to the original Map object itself: c ...
«
25
26
27
28
29
30
31
32
33
34
»
Free download pdf