How can I define a set in Matlab which has these properties:
- Unique items
- Efficient search
- Ordered
Maybe there isn’t a built-in container, So how can I combine some stuff to gain above things as same as std::set in C++?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use Java’s HashSet like this:
In the comments it was pointed out that a HashSet isn’t ordered. Which is totally true. My mistake! You could use a TreeSet instead, which is ordered: