How to perform the following commands?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
M
am 24 Mai 2022
Beantwortet: Walter Roberson
am 24 Mai 2022
How to perform the following commands:
result1 = m(:,abs(m(2,:))< threshold ); .......... This line I want to exclude zero value also.(I mean if it zero ignore it and look at the next value)
[~,idx] = min(abs(result1(1,:))); ....... This line I want to exclude zero value also. (I mean if it zero ignore it and look at the next value)
3 Kommentare
Walter Roberson
am 24 Mai 2022
create a temporary vector that is abs() and replace 0 values with nan and min() that.
Or loop.
Akzeptierte Antwort
Walter Roberson
am 24 Mai 2022
temp = abs(result1(1,:));
temp(temp==0) = nan;
[~, idx] = min(temp) ;
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu NaNs 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!