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 CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by