I am using R2018b, and trying to use the function 'validtaestring', but it doesn't find a partial match. Has anyone tried that in this version?
1 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Guy Nir
2018-11-20
2 个评论
Image Analyst
2018-11-20
strfind returns an index or an empty null string.
You might want to use contains() like I did in my answer, unless you really need to know the index where the substring starts. If you have just one item, like you did, then you can also use strcmp() or ismember().
更多回答(1 个)
Image Analyst
2018-11-20
To find partial matches, don't use validatestring(). Use contains
validString = contains(str, STR2);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Argument Definitions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!