Effacer les filtres
Effacer les filtres

generate index for included subjects

1 vue (au cours des 30 derniers jours)
Peter P
Peter P le 25 Juil 2019
Modifié(e) : Andrei Bobrov le 25 Juil 2019
I am trying to generate an index to exclude some subjects, so far I tried:
temp.ids = 101:130
excl = {'126' '127'};
% generate index
incl = true(size(temp.ids));
for i = 1:length(excl)
% compare strings
TF = strcmp(excl{i},temp.ids);
% set excluded subjects to 0
incl(TF==1)=0;
end
When I try using:
age = temp.age(incl);
the variable 'age' still includes all 30 subjects, however it should only show the included, i.e., 28. Any suggestions? Thanks in advance.

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 25 Juil 2019
Modifié(e) : Andrei Bobrov le 25 Juil 2019
temp.ids = 101:130;
excl = 126:127;
incl = ~ismember(temp.ids,excl);
age = temp.age(incl);

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays 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