Delete the values from array using histogram

조회 수: 5 (최근 30일)
Med Future
Med Future 2022년 6월 10일
답변: Voss 2022년 6월 11일
i have the following data ,shape of 79787x4, I have taken the 2nd dimension and create histogram and delte the value which are less then 13.
now, the output shape from this code is 79296x1 . I want to delete the corresponding indexes(rows) from remaining column which are delete from this histogram in the original dataset
in the following code the deleted_data_idx shows the deleted index
Batchdata=arr(:,2);
figure;
h=histogram(Batchdata,10000);
sumofbins=max(h.Values);
size_MP=round(0.2/100*sumofbins);
ValueofHistogram= h.Values;
Bindata=h.Data;
Binedges=h.BinEdges;
Binedges(end) = Inf;
deleted_data_idx = false(size(Bindata));
for i=1: length(ValueofHistogram)
if ValueofHistogram(i)<size_MP;
deleted_data_idx(Bindata >= Binedges(i) & Bindata < Binedges(i+1)) = true;
end
end
Bindata(deleted_data_idx) = [];
incomingdata= Bindata;

채택된 답변

Voss
Voss 2022년 6월 11일
arr(deleted_data_idx,:) = [];

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by