for loops and the if statement
Afficher commentaires plus anciens
This is a beginner question im sure i just dont understand why is it that i have to use 2 equal signs in the if statement?
for n=0:10;
fprintf('n=%d\n',n);
if n==0
i cannot use n=0 ??
thanks BN
Réponse acceptée
Plus de réponses (1)
sourav malla
le 26 Juin 2019
If you are assigning something inside the loop then its:
z=0;
And if you are checking a statement for true or false then:
z==0;
basically it will return logical 1 or 0 based upon 'true' or 'false' in matlab.
Catégories
En savoir plus sur Get Started with MATLAB dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!