Searching for permutations of a string in a list in MATLAB
In this video a colleague was looking in a large list to see if each element was a permutation of any element of a shorter list. I name these lists Haystack and Needle so it is easy to remember which I am looking for and which I am looking through. Because we are looking for any permutation of a three character string, it might seem like we would have to search three times for each element in the needle list. It turns out, if you sort the elements of each list, the permutations are no longer an issue. The function ismember is also useful in making this string searching in MATLAB go very quickly.
- Category:
- Format: Video,
- Level: Basic
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.