Finding an index in a structure with a 'char' field
조회 수: 14 (최근 30일)
이전 댓글 표시
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? ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/726709/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/726709/image.png)
댓글 수: 0
채택된 답변
Chunru
2021년 9월 1일
You can try the following or you post your data.
idx = strcmp({s.y}, 'ATC');
s(idx)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!