How to restart the some portion of script for number of times ?

I want to restart my some portion of script for number of times. Script is basically input-math-disp type code... Is there any loop or function to do so ? Please help...thx HAVE A GOOD DAY...

 Réponse acceptée

Guillaume
Guillaume le 26 Août 2016
Even better than a loop (or in combination). Extract the portion of script that is repeated into a function that you then call from your script.

Plus de réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 22 Août 2016
Use a for loop

4 commentaires

How ? Can u give me an example please...
for K = 1 : 3
X = input( sprintf('X #%d', K));
Y = X.^2;
end
Thx Walter...
Alternately, type
help for
in the command line.

Connectez-vous pour commenter.

Catégories

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by