findStringInCell(C,​S)

版本 1.0.0.0 (1.3 KB) 作者: Sugato
This function returns the index of a string (S) in a cell array (C).
29.0 次下载
更新时间 2017/8/12

查看许可证

Function Description:
This function returns the index of a string (S) in a cell array (C).

AUTHOR: Sugato Ray | Created on: 18-May-2017 | ray.sugato[at]gmail.com

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PLEASE ACKNOWLEDGE THE AUTHOR IF YOU USE THIS CODE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


INPUT:
C = Cell array
S = String to look for

OUTPUT:
Index = index of the string in the cell

EXAMPLE:
Index = findStringCell(C,S);
Index = findStringCell({'alpha','beta','x','z'},'beta'); % this returns Index = 2

引用格式

Sugato (2024). findStringInCell(C,S) (https://www.mathworks.com/matlabcentral/fileexchange/64098-findstringincell-c-s), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2016a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0