executing for loop from 1 to n except one number
    17 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    negin tebyani
 il 9 Feb 2018
  
    
    
    
    
    Commentato: negin tebyani
 il 9 Feb 2018
            I have a specific number, for example row=3; and I have a for like:
 for i=1:n
    SOMETHING
 end
and n is a matrix's row number, I need to do something in this for, and it should be done on all indexes except the one that is determined in row=3. I mean I want to do something on all 1 to n and not for 3. how can I do this?
0 Commenti
Risposta accettata
  Walter Roberson
      
      
 il 9 Feb 2018
        for i = setdiff(1:n, row)
  SOMETHING
end
In this code, row could be a row vector if you wanted to exclude multiple values
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Creating and Concatenating Matrices 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!

