필터 지우기
필터 지우기

if condition for counting

조회 수: 15 (최근 30일)
Waqas Siddique
Waqas Siddique 2021년 2월 18일
댓글: Waseem AL Aqqad 2021년 2월 19일
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.

답변 (2개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021년 2월 18일
편집: KALYAN ACHARJYA 2021년 2월 18일
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 2021년 2월 18일
편집: Waseem AL Aqqad 2021년 2월 18일
B=randi(10,1,815);
idx=find(B>4);
B(idx);
  댓글 수: 3
Rik
Rik 2021년 2월 18일
Did you read the documentation for the find function?
Waseem AL Aqqad
Waseem AL Aqqad 2021년 2월 19일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by