Finding the index of a cell element

2 ビュー (過去 30 日間)
Kamia Kavi
Kamia Kavi 2022 年 12 月 12 日
回答済み: Voss 2022 年 12 月 12 日
I have a cell array as follows;
A{1} = 'xname1x';
A{2} = 'xname2x';
A{3} = 'xname3x';
How can I find the index of the element whose value contains ‘name1’?

採用された回答

Voss
Voss 2022 年 12 月 12 日
A{1} = 'xname1x';
A{2} = 'xname2x';
A{3} = 'xname3x';
idx = find(contains(A,'name1'))
idx = 1

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by