Effacer les filtres
Effacer les filtres

Create a subtable with specific values in a column

9 vues (au cours des 30 derniers jours)
Natalia Lopez
Natalia Lopez le 4 Sep 2019
Commenté : Natalia Lopez le 4 Sep 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

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by