필터 지우기
필터 지우기

Find first substring not in map

조회 수: 1 (최근 30일)
Jorge Zapata
Jorge Zapata 2012년 10월 5일
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개)

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by