Searching for Permutations of a String in a List in MATLAB
(Originally posted on Doug's MATLAB Video Tutorials blog.)
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.
Recorded: 7 Mar 2014
Featured Product
MATLAB
Up Next:
Related Videos:
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)