Find NaN elements in a matrix
    279 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    NS
      
 am 12 Okt. 2011
  
    
    
    
    
    Kommentiert: Whitney
 am 22 Nov. 2021
            Hi Guys,
How can I find the exact location of NaN elements in a matrix. I work with really large arrays (size 1500*200).
How can I find which row has a NaN value in a column matrix or vice versa.?
Thanks
N
0 Kommentare
Akzeptierte Antwort
  Walter Roberson
      
      
 am 12 Okt. 2011
        [row, col] = find(isnan(YourMatrix));
6 Kommentare
  Ana Paulina García
 am 5 Okt. 2020
				for me this actually creates a 1x0 variable named row and another one named col. None of the variables tells me the index :( 
Weitere Antworten (3)
  Wayne King
    
      
 am 12 Okt. 2011
        One way:
X = ones(10,4);
X(3,4) = NaN;
indices = find(isnan(X) == 1);
[I,J] = ind2sub(size(X),indices);
0 Kommentare
  Elizabeth Drybrugh
 am 3 Mai 2018
        
      Bearbeitet: Elizabeth Drybrugh
 am 3 Mai 2018
  
      Do this to get the sum
    sum(isnan(x))
For other functions, it depends on what you actually need....
0 Kommentare
Siehe auch
Kategorien
				Mehr zu Logical 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!








