Convert cell of strings to numbers
4 次查看(过去 30 天)
显示 更早的评论
Hallo, On the one hand I have a cell of strings (with around 400 elements) and on the other hand in a loop I have another element (different each time) so I have to find the position of that element at the big array each time. Which is really slow.... so my intention is to convert the cell to numbers (the other string as well) and then just find in the array of number one number.
Is that possible?
Thanks in advance!
2 个评论
Azzi Abdelmalek
2015-2-25
编辑:Azzi Abdelmalek
2015-2-25
Can you post a short example? and post the code you are using
采纳的回答
Guillaume
2015-2-25
Neither the ismember nor the indexDictionary indirection is necessary:
aux = find(strcmp(dictionary, value), 1);
In all likelyhood ismember dispatches to strcmp when given strings, so bypass the middleman which you don't need in your case.
更多回答(2 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!