필터 지우기
필터 지우기

How to remove multiple elements from an array?

조회 수: 19 (최근 30일)
Steven
Steven 2013년 9월 18일
I have an array x which is equal to [1:50].
I am trying to remove all the elements that are divisible by 3, 4, and 5.
I cannot figure this out for the life of me, I'm sure it will involve some sort of For Loop and three different mod functions.
I would greatly appreciate help from anyone!

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 19일
편집: Azzi Abdelmalek 2013년 9월 19일
a=1:50
a(~mod(a,3)|~mod(a,4)|~mod(a,5))=[]
  댓글 수: 1
Steven
Steven 2013년 9월 19일
Thank you so much for your help. I really appreciate it!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by