# How to set a threshold based on the values of an array vector ?

31 vues (au cours des 30 derniers jours)
chocho le 7 Mai 2017
Commenté : chocho le 7 Mai 2017
hi experts, I want to set a threshold based on the percentage of values in an array vector(320*1), Thus the value with the highest percentage will be my threshold for future use.
I want to plot the histogram of this array while the Y-axis have the percentage of each value occured in the array vector.
Any help or an ideat about how to set a threshold, i really appreciate it !
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
chocho le 7 Mai 2017
hist(Support_gene);

Connectez-vous pour commenter.

### Réponses (1)

Image Analyst le 7 Mai 2017
Use the > operator:
aboveThresholdIndexes = yourSignal > someThresholdValue; % A logical vector.
% If you want to extract those points:
aboveThreshold = yourSignal(aboveThresholdIndexes);
I leave it up to you to computer someThresholdValue because we don't know exactly what "threshold based on the percentage of values in an array" means. Do you mean like a percentage of 320 (the number of values in the array), or do you somehow want to take into account the values of those elements, in which case cumsum() might help?
##### 4 commentairesAfficher 2 commentaires plus anciensMasquer 2 commentaires plus anciens
Image Analyst le 7 Mai 2017
That's because you never defined someThresholdValue. If you need to determine it by looking at the histogram, then call the histogram function:
histogram(yourSignal);
Obviously, just like someThresholdValue, you need to replace yourSignal with the actual name of your variable, and of course you need to have defined it already.
chocho le 7 Mai 2017
@Image Analyst Friend my goal is to define the threshold, how to define it and still don't know what's it. did you get it ?
Even histogram(yourSignal); is not working because of my array vector is of type double.

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Image Thresholding dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!