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

Answers (1)

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.

Categories

Asked:

on 19 May 2022

Answered:

on 19 May 2022

Community Treasure Hunt

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

Start Hunting!