Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: goto

Subject: goto

From: Markus Due Jakobsen

Date: 21 Jun, 2008 09:50:17

Message: 1 of 5

Hi,

This might seem like a stupid question, but how does the
goto function work in matlab?

I tried 'goto(Inf)' to go to the end of the program, but I
can't get it to work..

Here is some of the script:
[FileName,PathName] = uigetfile('*','Select the file');

try
    File=importdata(FileName);
catch myEx
    disp(myEx.message)
    errordlg('Unable to open file','Error')
    goto(Inf)
end

Any suggestions?

Markus


Subject: goto

From: Rune Allnor

Date: 21 Jun, 2008 10:32:35

Message: 2 of 5

On 21 Jun, 11:50, "Markus Due Jakobsen" <markus...@gmail.com> wrote:
> Hi,
>
> This might seem like a stupid question, but how does the
> goto function work in matlab?
>
> I tried 'goto(Inf)' to go to the end of the program, but I
> can't get it to work..
>
> Here is some of the script:
> [FileName,PathName] =3D uigetfile('*','Select the file');
>
> try
> =A0 =A0 File=3Dimportdata(FileName);
> catch myEx
> =A0 =A0 disp(myEx.message)
> =A0 =A0 errordlg('Unable to open file','Error')
> =A0 =A0 goto(Inf)
> end
>
> Any suggestions?

Use RETURN if you just want to exit the function.

Rune

Subject: goto

From: John D'Errico

Date: 21 Jun, 2008 11:28:02

Message: 3 of 5

"Markus Due Jakobsen" <markusdue@gmail.com> wrote in message
<g3iisp$prs$1@fred.mathworks.com>...
> Hi,
>
> This might seem like a stupid question, but how does the
> goto function work in matlab?
>
> I tried 'goto(Inf)' to go to the end of the program, but I
> can't get it to work..
>
> Here is some of the script:
> [FileName,PathName] = uigetfile('*','Select the file');
>
> try
> File=importdata(FileName);
> catch myEx
> disp(myEx.message)
> errordlg('Unable to open file','Error')
> goto(Inf)
> end
>
> Any suggestions?

As Rune suggests, use return instead. But
I'm curious as to why you think that goto is
a valid function in matlab? It is not.

John

Subject: goto

From: Justus Skorps

Date: 21 Jun, 2008 11:44:41

Message: 4 of 5

On 21 Jun., 11:50, "Markus Due Jakobsen" <markus...@gmail.com> wrote:
> Hi,
>
> This might seem like a stupid question, but how does the
> goto function work in matlab?
>
> I tried 'goto(Inf)' to go to the end of the program, but I
> can't get it to work..
>
fortunately there is no goto in Matlab...

Subject: goto

From: D. Ismay

Date: 21 Jun, 2008 14:00:09

Message: 5 of 5

Justus Skorps wrote on 21-Jun-08 04:44 :
> On 21 Jun., 11:50, "Markus Due Jakobsen" <markus...@gmail.com> wrote:
>> Hi,
>>
>> This might seem like a stupid question, but how does the
>> goto function work in matlab?
>>
>> I tried 'goto(Inf)' to go to the end of the program, but I
>> can't get it to work..
>>
> fortunately there is no goto in Matlab...

...until there is a 'come from'.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
goto Markus Due Jakobsen 21 Jun, 2008 05:50:20
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics