2%> Return the input ``hashmap``
while all cases
3%> of keys matching the input ``keys`` are deleted
4%> along with their corresponding values immediately
5%> appearing after the elements matching the input ``keys``.
7%> \param[in] keys : The input MATLAB cell array of rank 1 containing
8%> the key(s) to search
for in the input pair
list.
9%> \param[in] hashmap : The input cell array of even number of elements
10%> containing the ``(key, val)`` pairs of the input
11%> ``hashmap`` in sequence as element of the cell array.
14%> ``keyval`` : The output cell array of even number of elements
15%> containing the ``(key, val)`` pairs of the keys
16%> in the input argument ``keys``.<br>
17%> ``hashout`` : The output cell array of even number of elements
18%> containing the ``(key, val)`` pairs of the input
19%> ``hashmap``
while all instances of keys matching
20%> the input ``keys`` along with their values are deleted.<br>
25%> [keyval, hashout] = pm.matlab.hashmap.popKeyVal(keys, hashmap)
30%> \include{lineno} example/matlab/hashmap/
popKeyVal/main.m
32%> \include{lineno} example/matlab/hashmap/
popKeyVal/main.out.m
37%> \JoshuaOsborne, May 21 2024, 10:49 PM, University of Texas at Arlington<br>
38%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
39%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
40function [keyval, hashout] =
popKeyVal(keys, hashmap)
41 vararginLen = length(hashmap);
42 if mod(vararginLen, 2) ~= 0
43 help(
"pm.matlab.hashmap.popKeyVal");
45 +
"The length of ``hashmap`` must be even." + newline ...
47 +
"length(hashmap) = " +
string(vararginLen) + newline ...
51 hashout = cell(length(hashmap), 1);
52 keyval = cell(length(hashmap), 1);
55 strkeys = string(keys);
56 for jkey = 1 : 2 : vararginLen
57 if ~any(strcmpi(
string(hashmap{jkey}), strkeys))
58 counter = counter + 1;
59 hashout{counter} = hashmap{jkey};
60 counter = counter + 1;
61 hashout{counter} = hashmap{jkey + 1};
63 kvcount = kvcount + 1;
64 keyval{kvcount} = hashmap{jkey};
65 kvcount = kvcount + 1;
66 keyval{kvcount} = hashmap{jkey + 1};
69 hashout = hashout(1 : counter);
70 keyval = keyval(1 : kvcount);
function list()
Return a list of MATLAB strings containing the names of OS platforms supported by the ParaMonte MATLA...
function popKeyVal(in keys, in hashmap)
Return the input hashmap while all cases of keys matching the input keys are deleted along with their...