MATLAB Answers

for loop in matlab

4 views (last 30 days)
hang dong
hang dong on 10 Jun 2019
Commented: Utkarsh Belwal on 10 Jun 2019
How can the for loop start to start from the value 0?

Answers (1)

Utkarsh Belwal
Utkarsh Belwal on 10 Jun 2019
% Here is a for loop which starts from 0 and ends at 100.
for i = 0 : 100
% Your Code
end
  3 Comments
Utkarsh Belwal
Utkarsh Belwal on 10 Jun 2019
MATLAB uses 1 based indexing not zero based so you can not access zero index in MATLAB.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!