How can I filter values >120 and <120

6 views (last 30 days)
I want filter values in a matrix (A) where average value is 120, and I want convert values <120 in zeros and values >120 in ones. I write this code ... if true
A=[53 9 36 161 164 50;
149 60 162 173 51 3;
194 179 166 90 8 0;
192 196 150 46 7 0;
189 192 189 158 71 17;
183 182 192 190 179 137];
[m n]= size(A); for i=1:m; for j=1:n if(m>=120) B=zeros(m,n); else B=ones(m,n) end end end
end

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 16 Jun 2013
A(A<120)=0;
A(A>120)=1

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!