How to delete Multiple of any Value in Array In MATLAB

1 次查看(过去 30 天)
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.

请先登录,再进行评论。

更多回答(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