Characters linear search
1 次查看(过去 30 天)
显示 更早的评论
sir i need to store characters like (man cat red blue) in 2X2 matrix and then i need to perform linear search , that is if i give man it must result man is first character please help in coding
0 个评论
采纳的回答
Andrew Newell
2011-3-28
>> A = {'man', 'cat'; 'red', 'blue'}'
A =
'man' 'red'
'cat' 'blue'
>> i = find(strcmp('man',A));
This gives the indices so that
A{i}
returns
ans =
man
( edited to respond to comment )
4 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!