Replacing whole row with NaN's if first value is equal to 13 or 15.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi! I have a matrix in which I want to replace the whole row with NaNs if the value of the first row is equal to 13 of 15. Can anyone help me with this?
0 Kommentare
Akzeptierte Antwort
Voss
am 19 Jun. 2022
Do you mean the value of the first column is equal to 13 or 15?
A = randi(20,10,5)
idx = A(:,1) == 13 | A(:,1) == 15;
A(idx,:) = NaN
Or do you mean replace the whole column if the value of the first row is 13 or 15?
A = randi(20,10,5)
idx = A(1,:) == 13 | A(1,:) == 15;
A(:,idx) = NaN
2 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!