Setting an array of a vector = NaN
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Christoph Meier
am 11 Sep. 2015
Kommentiert: Star Strider
am 11 Sep. 2015
Dear Matlab community,
I am trying to set a certain array within a vector = NaN
Example:
If I have a vector with a dimension 9,1:
0.0001
0.0003
0.0001
0.0002
2
3
4
5
6
And I would like to set the elements 1-4 = NaN, to get the following output:
NaN
NaN
NaN
NaN
2
3
4
5
6
Does someone know how to set an array within the vector to NaNs? In this case, I know that element 1-4 should be NaNs.
Thank you very much!
Chris
0 Kommentare
Akzeptierte Antwort
Star Strider
am 11 Sep. 2015
This will do what you want:
V = [0.0001
0.0003
0.0001
0.0002
2
3
4
5
6];
V(V<1) = NaN
4 Kommentare
Star Strider
am 11 Sep. 2015
My pleasure.
I thought you wanted to set specific conditions on what elements became NaN.
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!