Histogram between peeks get indecies and values

3 ビュー (過去 30 日間)
tim pearce
tim pearce 2024 年 2 月 22 日
コメント済み: tim pearce 2024 年 3 月 23 日
Hi all,im trying to programmatically remove some data between the central peeks as shown on the image. The source data is a point cloud but the part I’m struggling is the 4 peeks are always there but their height and position may change but no matter what I need the undecided or values of the items that are always in the middle in this example 34 35 and 36. I’m not really sure where to start so any hints are greatly appreciated. Many thanks tim
  2 件のコメント
Voss
Voss 2024 年 2 月 22 日
"...as shown on the image"
No image is shown.
tim pearce
tim pearce 2024 年 2 月 22 日
移動済み: Voss 2024 年 2 月 22 日

Upps here we go

サインインしてコメントする。

回答 (1 件)

Vatsal
Vatsal 2024 年 3 月 20 日
Hi,
From the given description, it seems like you are trying to identify and remove the data between certain peaks in a histogram.
Here is how you can do it in MATLAB:
% Assuming 'data' is your histogram data
[peaks,locs] = findpeaks(data);
% Initialize an array to hold the indices of the data to be removed
indices_to_remove = [];
% Loop through the peaks
for i = 1:length(locs)-1
% Get the start and end indices
start = locs(i);
endd = locs(i+1);
% Get the indices of the data between the peaks
indices_between_peaks = start+1:endd-1;
% Add these indices to the array of indices to be removed
indices_to_remove = [indices_to_remove, indices_between_peaks];
end
% Now you can remove the data at these indices
data(indices_to_remove) = [];
This code will find the peaks in the given data and then extract the indices of the data between each pair of peaks. It then removes this data from the original data array. Please replace 'data' with your actual data variable. The 'indices_to_remove' variable contains the indices of the data between each pair of peaks. You can add your own logic to process or remove this data as per the requirements.
Please note that the code above assumes that you want to remove all data between the peaks. If you only want to remove data between certain peaks (for example, only between the 2nd and 3rd peak), the code needs to be adjusted accordingly.
To learn more about “findpeaks” usage and syntax, you may refer to the MathWorks documentation link below: -
I hope this helps!
  1 件のコメント
tim pearce
tim pearce 2024 年 3 月 23 日
Thanks yes I’ve managed to put something together with find peeks Many thanks Tim

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by