Ouput value manupulation?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Azad Khandoker
am 29 Jul. 2019
Beantwortet: Azad Khandoker
am 29 Jul. 2019
I have got different values from a certain calculation,
Where x = (0.5, 0.70, -0.81, -0.90)
I want to get read of the minus values and replace with '0', I am doing like-
x (3) = 0; % x (3) is the position of the value in the specific column
x (4) = 0; % x (4) is the position of the value in the specific column
Now I am having x = (0.5, 0.70, 0, 0)
So, my question is there any other possible way do that? i, e with functions or limits
0 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 29 Jul. 2019
Bearbeitet: Andrei Bobrov
am 29 Jul. 2019
x_new = x.*(x > 0);
or
x_new = x;
x_new(x_new <= 0) = 0;
or
xnew = max(x,0);
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB 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!