Videos
The MATLAB for loop syntax is
for i = values
program statements
:
end
where values is one of
start:endstart:step:end, or- an array of values.
The form start:end assumes a step of 1, whereas you want a step (or increment) of 25, so use the second form. From your question, for(int i = 0; i < 1000; i+=25) generates a list of the numbers 0 25 50 ... 950 975, i.e. it does not include 1000 (notice the i < 1000; in the for loop), so we can't use end=1000 in out MATLAB syntax. Instead use end = 1000-25 = 975:
for i = 0:25:975
program statements
:
end
will yield the same values of i as the C equivalent.
Note: see my comment on Mithun Sasidharan's answer. His answer yields different numbers for the C and MATLAB for loops (and he seems to have dropped the for from his MATLAB answer). His answer gives 0 25 50 ... 950 975 for the C loop and 0 25 50 ... 950 975 1000 for his MATLAB code.
Edit: Aashish Thite's answer raises an important point about for loops and array indexing which differs between C and MATLAB.
The for loop
for (int i = 0; i <= 1000; i+=25)
can be converted to MATLAB for loop in this way:
>> for i = [0:25:1000]
# Code
end