Skip to content
Prev 59970 / 398502 Next

Correct Syntax for a Loop

ebashi wrote:
Solution to the question:

a) you cannot loop to length(x.dif), x.dif[i+2] does not exist for 
i==length(x.dif).
b) Use && instead of "and" in this case
c) vector operations are much mor

Hint: If you lengthen the vectors appropriately, you can apply the 
comparisons vectorized  rather than in a loop...

Uwe Ligges