See Akshata's response below for how to structure the if statement.
As a general rule of good practice, it is better to avoid using i and j and loop indices, MATLAB reserves these for complex numbers (i.e., sqrt(-1)). Use ii and jj instead
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
3 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/181645-i-want-to-create-a-for-loop-which-creates-different-pairs-each-time#comment_269984
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/181645-i-want-to-create-a-for-loop-which-creates-different-pairs-each-time#comment_269984
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/181645-i-want-to-create-a-for-loop-which-creates-different-pairs-each-time#comment_270015
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/181645-i-want-to-create-a-for-loop-which-creates-different-pairs-each-time#comment_270015
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/181645-i-want-to-create-a-for-loop-which-creates-different-pairs-each-time#comment_270031
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/181645-i-want-to-create-a-for-loop-which-creates-different-pairs-each-time#comment_270031
Sign in to comment.