using function to remove elements from a large matrix

조회 수: 1 (최근 30일)
Malik Khan
Malik Khan 2019년 12월 25일
편집: Malik Khan 2020년 1월 3일
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
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 12월 25일
Have you tried, please show your efforts?
Malik Khan
Malik Khan 2019년 12월 25일
I have not attempted this yet because I have no idea where to start

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2019년 12월 25일
편집: the cyclist 2019년 12월 25일
idxToKeep = ismember(M(:,2),[1,2,3,11,12]);
M = M(idxToKeep,:);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by