Find a string cell into a variable of a table
이전 댓글 표시
Hi everyone!
I need to find the position of a specific string cell of Table A (first row and first column) into the first column of another Table B, how can I do?
I’ve tried with
a= strcmp(A(1,1), B(1,1));
but it doesn’t work.
The variable a is returned as 0 and it should be 1 since I know that the string cell is common between the 2 tables.
Thank you,
Anna
댓글 수: 3
Mario Malic
2021년 2월 4일
If you run this in your code, what are the outputs?
A(1,1)
B(1,1)
KSSV
2021년 2월 4일
Have a look on contains.
Anna Mascaretti
2021년 2월 4일
채택된 답변
추가 답변 (1개)
KSSV
2021년 2월 4일
Read about ismember.
idx = ismember(B(:,1),A(1,1)) ; % this will give indices where the elements match
Also have a look on contains.
카테고리
도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!