MATLAB Answers

Calculate frequency for each gridded

3 views (last 30 days)
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?

Accepted Answer

KSSV
KSSV on 2 Apr 2021
Let A be your matrix/ grid.
idx = A<-1 & A>-3 ;
A(idx) = 1 ;
A(~idx) = 0 ;
nnz(A==1)
nnz(A==0)
  5 Comments
Nurul Ain Basirah Zakaria
sir, thank you very much. i will try to understand looping better

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by