generate index for included subjects
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Peter P
el 25 de Jul. de 2019
Editada: Andrei Bobrov
el 25 de Jul. de 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.
0 comentarios
Respuesta aceptada
Andrei Bobrov
el 25 de Jul. de 2019
Editada: Andrei Bobrov
el 25 de Jul. de 2019
temp.ids = 101:130;
excl = 126:127;
incl = ~ismember(temp.ids,excl);
age = temp.age(incl);
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!