if condition for counting

10 vues (au cours des 30 derniers jours)
Waqas Siddique
Waqas Siddique le 18 Fév 2021
Commenté : Waseem AL Aqqad le 19 Fév 2021
Hi,
I have a list of numbers(double type stored in a variable. I want to see when a number is greater than '4', how can I disply that number.

Réponses (2)

KALYAN ACHARJYA
KALYAN ACHARJYA le 18 Fév 2021
Modifié(e) : KALYAN ACHARJYA le 18 Fév 2021
To display numbers more than 4, here var is the variable name of given data
num_data=var(var>4)
To count the numbers, which are more than 4
count_data=sum(var>4)

Waseem AL Aqqad
Waseem AL Aqqad le 18 Fév 2021
Modifié(e) : Waseem AL Aqqad le 18 Fév 2021
B=randi(10,1,815);
idx=find(B>4);
B(idx);
  3 commentaires
Rik
Rik le 18 Fév 2021
Did you read the documentation for the find function?
Waseem AL Aqqad
Waseem AL Aqqad le 19 Fév 2021
By the way it's good to accept volunteers' answers if it helped you. Actually, You never did that as I can see from your MATLAB Answers profile.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Graphics Object Programming 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!

Translated by