how to find the position in a string array

조회 수: 8 (최근 30일)
Shown
Shown 2014년 4월 6일
댓글: Jan 2014년 4월 6일
attributes={'aaaa','bbbb','cccc','dddd' };
str='cccc';
how to find position 3 ?

채택된 답변

Walter Roberson
Walter Roberson 2014년 4월 6일
Read the documentation in ismember()
  댓글 수: 2
Shown
Shown 2014년 4월 6일
thanks, I got it.
[a,b]=ismember(str,attributes)
b
Jan
Jan 2014년 4월 6일
I'd prefer this instead:
index = find(strcmp(attributes, str))

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by