MATLAB: Create a subtable with specific values in a column

findtable

Hi!
I have a table with some demographic variables (age, gender, etc) and includes a column with participants ID. I need to create 2 subtables from this main table selecting only certain participants ID (as they were randomized there is no way to find a specific order to substract them). Each subtable should have only certain ID's (split into 2 groups basically). The rest of the variables/columns remain the same, I just need to find the specific rows (where ID is indicated).
I have tried using the function find, but I cannot use it with more than 3 input arguments.
The column ID would like something like this:
Subtable = find(Maintable.ID, 1245 1097 1893 1235 1514 1023 1071 1026 1009 1061 1033 1059 1551 1042 3008)
Any help would be much appreciated!
Thank you

Best Answer

ix = ismember(Maintable.ID, [1245 1097 1893 1235 1514 1023 1071 1026 1009 1061 1033 1059 1551 1042 3008]);
Subtable = Maintable(ix,:)