MATLAB Answers

How do I replace values in a 400x400 matrix with values of 1x1001 array (r) and then replace all r <= 0.02 with 1 and r>0.02 with 0?

3 views (last 30 days)
I need to make a 400 x 400 matrix, with the values of r = [0.0001, 0.0002,......,0.1001] and then replace all r smaller or equal to 0.02 with an 1 and r bigger than 0.02 with 0.
I used this, but the matrix stays full of zeroes:
for ii = 1:400
if r(ii)<0.02
m(ii) = 1;
m(ii) = 0;
can someone help me with this?

More Answers (0)

Community Treasure Hunt

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

Start Hunting!