How can I replace non positive elements of matrix with a certain number
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lily
am 16 Mai 2015
Kommentiert: Lily
am 16 Mai 2015
For example A=[7 4 2 1 -0.2 -3]
I want to get [7 4 2 0 0 ]
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 16 Mai 2015
max(A,0)
if the replacement is to be 0 for all values less than 0.
Otherwise,
B = A;
B(A<0) = new number
for any other replacement number
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!