Replacing whole row with NaN's if first value is equal to 13 or 15.
    3 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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 Commenti
Risposta accettata
  Voss
      
      
 il 19 Giu 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
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su NaNs in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!