필터 지우기
필터 지우기

Finding an index in a structure with a 'char' field

조회 수: 14 (최근 30일)
Natalija Nikolic
Natalija Nikolic 2021년 9월 1일
댓글: Natalija Nikolic 2021년 9월 2일
Hello everyone,
I have a structure with 4 fields (see the photo). I want to get the row index when I specify the y I am looking for. For example, I want to get indices 1,2,3 and 4 back when I specify y='ATC'.
How can I do that?

채택된 답변

Chunru
Chunru 2021년 9월 1일
You can try the following or you post your data.
idx = strcmp({s.y}, 'ATC');
s(idx)
  댓글 수: 1
Natalija Nikolic
Natalija Nikolic 2021년 9월 2일
Thank you very much. It doesn't do exactly what I was aiming for, but it sure helped me a lot.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by