Path: news.mathworks.com!newsfeed-00.mathworks.com!oleane.net!oleane!ciril.fr!fr.ip.ndsoftware.net!newsfeed1.uni2.dk!dfeeder1.cybercity.dk!dspool1.cybercity.dk!dreader2.cybercity.dk!not-for-mail
From: "John" <johnjohn@sucker.com>
Newsgroups: comp.soft-sys.matlab
References: <ef1b760.-1@webx.raydaftYaTP>
Subject: Re: how to terminate a function?
Date: Tue, 15 Nov 2005 14:42:03 +0100
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Original
Lines: 21
Message-ID: <4379e5b5$0$67261$157c6196@dreader2.cybercity.dk>
NNTP-Posting-Host: 212.242.226.59
X-Trace: 1132062133 dreader2.cybercity.dk 67261 212.242.226.59:19736
Xref: news.mathworks.com comp.soft-sys.matlab:313714


try return or break



"Abo Bshire" <moh054@yahoo.com> skrev i en meddelelse 
news:ef1b760.-1@webx.raydaftYaTP...
> How can I terminate a function in a certain point?
> for example, assume:
>
> function a=myfun(b)
>
>  for i=1:b
>    i=i+1;
>     % if i=3
>     % a=i;
>     % terminate the function
>     % otherwise go on
>  end
>  a=i;