Azzera filtri
Azzera filtri

How to stop a simulation if condition is true

5 visualizzazioni (ultimi 30 giorni)
Fotis
Fotis il 3 Nov 2015
Modificato: Thorsten il 3 Nov 2015
Hi all
How to I force matlab to stop if a condition that I declare is true? What is the command I should use. I have
if m.water_lp_service > m.water_lp
display('m.water_lp_service exceeds m.water_lp')
end
and besides displaying that, I would like to force matlab to stop. Anyone?

Risposte (1)

Thorsten
Thorsten il 3 Nov 2015
Modificato: Thorsten il 3 Nov 2015
Put all code after end into the else clause of the if. If the if is within a loop, add a break after the display.

Categorie

Scopri di più su Parallel Computing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by