MATLAB: Find a string cell into a variable of a table

strcmpstring

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

Best Answer

A(1,1) and B(:,1) return tables but strcmp is designed to accept character vector | character array | cell array of character vectors | string array.
To access the cell-strings, you need to use curly brackets!
A = table({'a'});
B = table({'a';'n';'n';'a'});
strcmp(A{1,1}, B{:,1})
ans = 4x1 logical array
1 0 0 1