Find first substring not in map
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm using containers.Map class in Matlab as dictionary and I want to find the first substring (from left to right) that is not in my map.
For example, suppose I have the string 'math' and my map is something like this
key value
m 1
ma 2
. .
. .
. .
So if I start reading from left to right the first substring not in map would be 'mat'.
The first solution that comes to my mind is to loop every char and do some concatenation in order to find the substring that is not in my map using the method iskey(map, key) where key is the substring in each iteration.
Is there something more efficient to do this? Maybe some predefined function in matlab or at least a more elegant code.
Thanks
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!