Réponses (1)

Utkarsh Belwal
Utkarsh Belwal le 10 Juin 2019

0 votes

% Here is a for loop which starts from 0 and ends at 100.
for i = 0 : 100
% Your Code
end

3 commentaires

hang dong
hang dong le 10 Juin 2019
If you use a for loop for an array, you cannot get the value 0. Help me!
Walter Roberson
Walter Roberson le 10 Juin 2019
You can never index at 0 in MATLAB, regardless of what your loop starts at.
for i = 0 : 100
y(i+1) = x(i).^2 + 5;
end
Utkarsh Belwal
Utkarsh Belwal le 10 Juin 2019
MATLAB uses 1 based indexing not zero based so you can not access zero index in MATLAB.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Question posée :

le 10 Juin 2019

Commenté :

le 10 Juin 2019

Community Treasure Hunt

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

Start Hunting!

Translated by