ismember to filtered table

i am trying to filter a dataset by using ismember(...), which gives me a logical array and the indexes. now i want to put it in a table but i'm not sure how to do that. can someone help me out?
code:
[a,b]=ismember('meta_data_mri.MRID','MRIdata.subjects');
tbl_meta_data_mri_filtered = ???
output:
>> [a,b]=ismember('meta_data_mri.MRID','MRIdata.subjects')
a =
1×18 logical array
0 1 1 1 0 1 1 1 1 0 0 0 0 1 1 1 1 0
b =
Columns 1 through 12
0 13 6 5 0 4 5 6 5 0 0 0
Columns 13 through 18
0 8 1 2 3 0

回答 (1 件)

Voss
Voss 2022 年 5 月 19 日

0 投票

That's doing ismember with the names of the files.
[a,b]=ismember('meta_data_mri.MRID','MRIdata.subjects')
a = 1×18 logical array
0 1 1 1 0 1 1 1 1 0 0 0 0 1 1 1 1 0
b = 1×18
0 13 6 5 0 4 5 6 5 0 0 0 0 8 1 2 3 0
[a,b]=ismember('abbacadcemoqsuwy','abcdefghijkrstuvwxyz')
a = 1×16 logical array
1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1
b = 1×16
1 2 2 1 3 1 4 3 5 0 0 0 13 15 17 19
If you want to operate on the actual data, first you must read the contents of the files into variables, e.g., using readtable, readmatrix, or readcell, etc., depending on the format and contents of the files.

カテゴリ

ヘルプ センター および File ExchangeTables についてさらに検索

タグ

質問済み:

2022 年 5 月 19 日

回答済み:

2022 年 5 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by