Find first substring not in map
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!