3

Java has HashSet class which I can use to create sets and add element in constant time making it efficient to compute unique values in a list.

How can I do the same in MATLAB? Is there an equivalent native class? This question proposes using Java's HashSet but does not provide native class.

Community
  • 1
  • 1
Bob
  • 561
  • 1
  • 6
  • 18
  • What's wrong with [`struct`](http://www.mathworks.com/help/matlab/ref/struct.html)? Alternatively, you could use [`table`](http://www.mathworks.com/help/matlab/ref/table.html). – Dev-iL Oct 11 '14 at 10:15
  • I did not try them but what I eventually used is containers.Map with arbitrary key value and then finally fetched the key set... I think it is similar how you are suggesting to use struct. – Bob Oct 11 '14 at 19:50
  • What do you mean by native? It goes Matlab->Java->C->Assembly->$$&%"§4. Which one do you consider native? – Derrops Aug 21 '15 at 09:00

1 Answers1

-4

Use struct in Matlab. Refer to http://www.mathworks.com/help/matlab/ref/struct.html

Robin D.
  • 41
  • 1
  • 3