Elemination in for loop

7 visualizzazioni (ultimi 30 giorni)
Najiya Omar
Najiya Omar il 23 Gen 2018
Commentato: Star Strider il 24 Gen 2018
I have Loop from 0.1:0.1:0.1 and I want to skip some cases in this loop like 0.3, 0.7 0.9

Risposta accettata

Star Strider
Star Strider il 23 Gen 2018
Try this:
v = 0.1:0.1:1;
exclude = [0.3, 0.7, 0.9];
[L1,L2] = ismembertol(v, exclude, 0.01);
new_v = v(~L1)
  4 Commenti
Najiya Omar
Najiya Omar il 24 Gen 2018
Thank you both It works
Star Strider
Star Strider il 24 Gen 2018
@Najiya Omar —
If my Answer helped you solve your problem, please Accept it!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by