how to change matrix element from zero to 1
Show older comments
hello i have one matrix 4 by 4 which only it has few zero element how can i say it check the element if less than one then change it to one ?
Answers (1)
the cyclist
on 17 May 2015
If A is your matrix,
A(A<1) = 1
3 Comments
amina shafanejad
on 17 May 2015
Walter Roberson
on 17 May 2015
for K = 1
A = max(A,1);
end
Stephen23
on 17 May 2015
Categories
Find more on Creating and Concatenating Matrices 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!