Effacer les filtres
Effacer les filtres

how to make a computer go to a line in mfile for a repeat execution

3 vues (au cours des 30 derniers jours)
Hi, I need hints on codes to use to make a computer execution go to a particular line in mfile and repeat the program. example B=[2 4 6 8]; C=[1.5 3 4 5.6]; A = sum(B-C); if A>1; g to say line 3 ? else disp(A)

Réponse acceptée

David Sanchez
David Sanchez le 15 Avr 2014
Matlab does not have that kind of implementation. On the other hand, you can do a work around using conditionals, either whiles or ifs.
For example, instead of
B=[2 4 6 8];
C=[1.5 3 4 5.6];
A = sum(B-C);
if A>1
go to say line 3 ?
else
disp(A)
end
You might do: ( I know the example has no sense, but it's to take your lines as an example)
A = 10;
while A>1
B=[2 4 6 8];
C=[1.5 3 4 5.6];
A = sum(B-C);
end
disp(A)

Plus de réponses (0)

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by