H = hash;
H('key') = value; %assign value to key
v = H('key'); % retrieve value for a key
H.keys % return cell array of keys
H. values % return array of values
H.idx % returns sparse matrix of indexes
Remark:
The hash function used is sum of the key.
It can easily be changed if needed.
Dimitar Atanasov (2019). Hash table declaration (https://www.mathworks.com/matlabcentral/fileexchange/26778-hash-table-declaration), MATLAB Central File Exchange. Retrieved .
Create scripts with code, output, and formatted text in a single executable document.
Miguel Hernandez (view profile)
Hello,
I'm seeing a two times increase for get operations for a ten times increase in data points. Is this expected from the hash design, or am I doing something wrong? In comparison, using java.util.Hashtable I am seeing a nearly constant get operation time for a ten times increase in data points.
Yen Hanning (view profile)
simple and useful.