Borrar filtros
Borrar filtros

Create a subtable with specific values in a column

9 visualizaciones (últimos 30 días)
Natalia Lopez
Natalia Lopez el 4 de Sept. de 2019
Comentada: Natalia Lopez el 4 de Sept. de 2019
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

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by