using function to remove elements from a large matrix

2 visualizaciones (últimos 30 días)
Malik Khan
Malik Khan el 25 de Dic. de 2019
Editada: Malik Khan el 3 de En. de 2020
I need to code for a matrix in which the rows are removed given thier value in a certain column is not of desire to me. eg, I want to keep the numbers 1 2 3 and 11 and 12 but not 4 5 6 or 13 14 etc.
  3 comentarios
KALYAN ACHARJYA
KALYAN ACHARJYA el 25 de Dic. de 2019
Have you tried, please show your efforts?
Malik Khan
Malik Khan el 25 de Dic. de 2019
I have not attempted this yet because I have no idea where to start

Iniciar sesión para comentar.

Respuesta aceptada

the cyclist
the cyclist el 25 de Dic. de 2019
Editada: the cyclist el 25 de Dic. de 2019
idxToKeep = ismember(M(:,2),[1,2,3,11,12]);
M = M(idxToKeep,:);

Más respuestas (0)

Categorías

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

Translated by