How can I extract rows using column values?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Jacob Ebilane
el 22 de Mayo de 2022
Comentada: Jacob Ebilane
el 22 de Mayo de 2022
I'm trying to use the emnist byclass data set which includes digits and upper/lower case letters. I don't need all of the letters so I wanted to remove the unnecessary ones. The emnist set uses the first column as a label 0-61 and only need for example 0-9 and <49, 55, 11, 32, 13, 29, 30, 20, 33, 43, 24> these ones.
0 comentarios
Respuesta aceptada
Walter Roberson
el 22 de Mayo de 2022
classes_needed = [49, 55, 11, 32, 13, 29, 30, 20, 33, 43, 24];
mask = ismember(emnist(:,1), classes_needed);
subset = emnist(mask,:);
Más respuestas (1)
MJFcoNaN
el 22 de Mayo de 2022
% random matrix
A=randi(50,10)
% needed lines index
ind=ismember(A(:,1), [0:9, 49, 55, 11, 32, 13, 29, 30, 20, 33, 43, 24]);
% needed rows
B=A(ind, :)
0 comentarios
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!