ismember to filtered table

10 visualizaciones (últimos 30 días)
Rizka Brandse
Rizka Brandse el 19 de Mayo de 2022
Respondida: Voss el 19 de Mayo de 2022
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

Respuestas (1)

Voss
Voss el 19 de Mayo de 2022
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.

Categorías

Más información sobre Tables 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