Javatpoint Logo
Javatpoint Logo

MATLAB for loop

The for loop is used to loop the statements a specific number of times. And it also keeps track of each iteration with an incrementing or decrementing index variable.

Syntax:

Example1:

Output:

The first prime number is: 1009
        1009

        2018

        3027

        4036

        5045

        6054

        7063

        8072

        9081

       10090

Example2:

Output:

value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 15
value of a: 16
value of a: 17
value of a: 18
value of a: 19
value of a: 20

Example3:

Output:

1
9/10
4/5
7/10
3/5
1/2
2/5
3/10
1/5
1/10
0

Next TopicMATLAB while loop





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA