matlab - Skipping an iteration in for loop -


is there effective way skip iteration in loop?

i have big dataset consists of option prices on s&p 500 index. dataset ranges 1992 2009. now, in total, have 3481 quoting dates have stored in vector call qdvector. i'm interested in quoting dates 2008 until 2009. each quoting date, run program. quoting dates of interest 3290 until 3481. however, in special cases (very few), program not work due lack of stock data. how skip these iterations in loop?

for instance, suppose have

for index = 3290:3481     [...] end  

and suppose not want take index == 3389 account. how skip iteration?

  • i can use while loop, not want take index in consideration @ all, since have plot parameters , want skip parameters corresponding index == 3389.
  • i can remove quoting date qdvector. not prefer approach since have change many other variables well.

i'm looking way skip iterations without consequences.

yes, continue statement allows that.

for index = 3290:3481     [...]     continue;    % wherever applicable end 

Comments