[matlab] Entsprechung für "try finally"
Gibt es in MatLab so etwas wie try..finally?
Ich finde nur try..catch, aber das entspricht ja try..except in Delphi. |
Re: [matlab] Entsprechung für "try finally"
Code:
=>
try
try_fkt(); finally finally_fkt(); end;
Code:
Oder sehe ich das falsch?
try
{ try_fkt(); } catch (..) { } finally_fkt(); |
Re: [matlab] Entsprechung für "try finally"
Ein Finally stoppt die Exception nicht, sie wird weiter durchgereicht.
|
Re: [matlab] Entsprechung für "try finally"
Zitat:
Man kann das natürlich auch mit try..catch umgehen:
Code:
Aber dann muss man das, was man normalerweise in Finally macht (hier: "close(wb)")zweimal schreiben.
wb = waitbar(0,'Please wait...');
try ... catch Exception close(wb); rethrow(Exception); end; close(wb); |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:25 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz