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.
Cite As
Dimitar Atanasov (2026). Hash table declaration (https://www.mathworks.com/matlabcentral/fileexchange/26778-hash-table-declaration), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R14
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Language Fundamentals > Data Types > Tables >
- MATLAB > Language Fundamentals > Data Types > Dictionaries >
Find more on Tables in Help Center and MATLAB Answers
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
@hash/
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
