Hello there! I am trying to alternate between odd and even runs to do different things inside a for loop, i.e. the odd and even runs will be interdependent. For example: at t = 1, x1 = 10; at t = 2, x2 = x1+m; at t = 3, x1 = x2 ( derived from t = 2) +n and so on. The odd values of t indicate a local phase, for example and the even values of t indicate a global phase. I am trying to do this in the following way, but was wondering if there is a more efficient way to do this. Thanks for your time :)
while t < 1000
if mod(t,2)
else
end
end
2 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/281605-how-to-iterate-odd-and-even-runs-alternatively#comment_362428
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/281605-how-to-iterate-odd-and-even-runs-alternatively#comment_362428
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/281605-how-to-iterate-odd-and-even-runs-alternatively#comment_363747
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/281605-how-to-iterate-odd-and-even-runs-alternatively#comment_363747
Sign in to comment.