How to delete Multiple of any Value in Array In MATLAB

조회 수: 1 (최근 30일)
Med Future
Med Future 2022년 12월 27일
댓글: Dyuman Joshi 2022년 12월 27일
Hello,I Have the following dataset, I want to delete the value which are multiple of any value present in array.
For example in this array 70 is present which is multiple of 35.

채택된 답변

Dyuman Joshi
Dyuman Joshi 2022년 12월 27일
편집: Dyuman Joshi 2022년 12월 27일
y=load('multiple.mat').Value;
%all the different value present in the array
z=unique(y)
z = 1×6
35 40 45 50 55 70
for j=unique(y)
y( (rem(y,j)==0) & y~=j )=[];
end
y
y = 1×1410
35 35 35 35 35 35 35 40 45 50 55 35 35 35 35 35 35 35 35 35 35 40 45 50 55 35 35 35 35 35
  댓글 수: 5
Med Future
Med Future 2022년 12월 27일
@Dyuman Joshi I want to delete those values in array, which are multiple of any value present in array.
Dyuman Joshi
Dyuman Joshi 2022년 12월 27일
I have edited my answer, please take a look at it again.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by