4.5

4.5 | 2 ratings Rate this file 28 Downloads (last 30 days) File Size: 13.53 KB File ID: #15831

hashtable class

by Christopher

 

04 Aug 2007 (Updated 13 Jul 2009)

general purpose hashtable

| Watch this File

File Information
Description

A general purpose hashtable implemented completely in MATLAB, with O(1) performance. Allows use of almost any arbitrary MATLAB type as keys or values, including user-defined classes. You can customize behavior by supplying custom equality and hashcode functions.

In general, not as fast as alternative methods which do not allow arbitrary types as keys.

A short README is included with all details.

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
12 Jun 2008 Martin .

Very nicely done and just what I've been looking for. I do java, but don't want to go down that track since other colleagues don't. So to have a hash table library in matlab is great. Easy to use and yes you can have a hash of a hash :-)

24 Jun 2010 Mike

Very nice, but could a method for removing elements.

25 Jun 2010 Karl

I have simply been creating hashtables with java.util.Hashtable for some time now. This is a good, thoroughly vetted hashtable class and is automatically available within matlab. Type 'methodsview java.util.Hashtable' for a list of methods. Note that a 'remove' method is included.

23 Mar 2011 Shawn Hershey

I've been having trouble findint MATLAB built-in support for hash tables and a coworker recently pointed me to this:

http://www.mathworks.com/help/techdoc/matlab_prog/brqqo5e-1.html

I can't see anything in the documentation that describes the underlying data structures but tests seem to imply O(1) insertion and lookup.

I wanted to mention that here since this page is currently the first hit for the Google search "MATLAB hashtable".

28 Apr 2011 Daniel Golden

Thank you for your comment, Shawn; as you mention, Matlab already has a hash table built in: the containers.Map class. They make it difficult to find by never mentioning the term "hash table" in the documentation.

Please login to add a comment or rating.
Updates
13 Jul 2009

- change to BSD license

Tag Activity for this File
Tag Applied By Date/Time
structures Christopher 22 Oct 2008 09:22:03
cell arrays Christopher 22 Oct 2008 09:22:03
hashtable Christopher 22 Oct 2008 09:22:03
general Christopher 22 Oct 2008 09:22:03
type Christopher 22 Oct 2008 09:22:03
keys Christopher 22 Oct 2008 09:22:03
values Christopher 22 Oct 2008 09:22:03
utili Christopher 22 Oct 2008 09:22:03

Contact us at files@mathworks.com