필터 지우기
필터 지우기

Create a subtable with specific values in a column

조회 수: 9 (최근 30일)
Natalia Lopez
Natalia Lopez 2019년 9월 4일
댓글: Natalia Lopez 2019년 9월 4일
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

채택된 답변

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by