필터 지우기
필터 지우기

Calculate frequency for each gridded

조회 수: 1 (최근 30일)
Nurul Ain Basirah Zakaria
Nurul Ain Basirah Zakaria 2021년 4월 2일
Hi. Is it possible that I want to,
Change the value of -1.00 untill -3.00 tu 1 and the rest as 0. Then, I want to know how much 1 in each grid, how can I calculate how much amount of 1?

채택된 답변

KSSV
KSSV 2021년 4월 2일
Let A be your matrix/ grid.
idx = A<-1 & A>-3 ;
A(idx) = 1 ;
A(~idx) = 0 ;
nnz(A==1)
nnz(A==0)
  댓글 수: 5
KSSV
KSSV 2021년 4월 2일
yes = 0 ; no = 0 ;
for i=1:5
for j=1:11
if idx(i,j)==1
yes = yes+1 ;
elseif idx(i,j) == 0
no = no+1 ;
end
end
end
Nurul Ain Basirah Zakaria
Nurul Ain Basirah Zakaria 2021년 4월 7일
sir, thank you very much. i will try to understand looping better

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by