Histogram between peeks get indecies and values

3 Ansichten (letzte 30 Tage)
tim pearce
tim pearce am 22 Feb. 2024
Kommentiert: tim pearce am 23 Mär. 2024
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 Kommentare
Voss
Voss am 22 Feb. 2024
"...as shown on the image"
No image is shown.
tim pearce
tim pearce am 22 Feb. 2024
Verschoben: Voss am 22 Feb. 2024

Upps here we go

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Vatsal
Vatsal am 20 Mär. 2024
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 Kommentar
tim pearce
tim pearce am 23 Mär. 2024
Thanks yes I’ve managed to put something together with find peeks Many thanks Tim

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by