Tags: code, command, continue, continueentering, entering, execution, matlab, programming, running, statement, tointermittently, window

F9 Code Running & Continue Entering Statement

On Programmer » Matlab

7,838 words with 6 Comments; publish: Sun, 18 May 2008 20:33:00 GMT; (200140.63, « »)

Hi,

I was just wondering what the reason might be for code execution to

intermittently stop in the Command Window, giving me a "Continue

entering statement" message when I've highlighted executable lines in

the editor and pressed F9 to run it.

If the answer is that a hard-return is required in my code, just as

you would need when entering commands in the Command Window, I've

already tried inputting them in my editor and still get the same

result.

Any tips would be appreciated.

All Comments

Leave a comment...

  • 6 Comments
    • Hakan Korkut wrote:

      >

      > Hi,

      > I was just wondering what the reason might be for code execution to

      > intermittently stop in the Command Window, giving me a "Continue

      > entering statement" message when I've highlighted executable lines

      > in

      > the editor and pressed F9 to run it.

      Hello Hakan,

      this message appears if a statement is incomplete, it has nothing to

      do with using the F9-function. For instance, if you *type*

      for k=1:10

      into the Command Window and press enter, you get this message to

      inform you that Matlab cannot start any action based on your input.

      HTH,

      Heinrich

      #1; Sun, 18 May 2008 20:34:00 GMT
    • Heinrich Acker wrote:

      >

      > Hakan Korkut wrote:

      execution

      > to

      "Continue

      > lines

      > Hello Hakan,

      > this message appears if a statement is incomplete, it has nothing

      > to

      > do with using the F9-function. For instance, if you *type*

      > for k=1:10

      > into the Command Window and press enter, you get this message to

      > inform you that Matlab cannot start any action based on your input.

      > HTH,

      > Heinrich

      Hi Heinrich,

      Thank you for your reply.

      Yes, that's what I thought as well, but I've tallied up all my 'if's

      and 'for's and 'end's and they all match. If I highlight individual

      lines of my code and press F9 I sometimes still get the message but

      then I just press 'Enter' while in the Command Window and it runs

      fine (otherwise I suppose I should get an error for the incomplete

      code due to a missing 'end' or something).

      Well, I am now running my code as a script by invoking the filename

      and just using the breakpoints in the editor to run specific

      portions. I suppose that's the right way to do it (who knows?)

      Thanks for your help, anyway.

      -Hakan

      #2; Sun, 18 May 2008 20:36:00 GMT
    • Hakan,

      if I understand you correctly, it shouldn't be the way you describe.

      In the usual way to get the message (which is not an error), pressing

      enter in the command window changes nothing, except getting a new

      line there.

      In my example

      for k=1:10

      you can type enter as long as you want. The message stays there. But

      if you type

      k, end

      later, the incomplete statement is executed. When using this

      functionality of the command window/editor/debugger, the same rules

      apply when pressing F9.

      You are right that this is not intended to go through a debug

      session. But you can put additional commands interactively into a

      debug session that way. So your system either has a problem, or you

      missed something in aligning your statements, or you found a bug.

      If you want to go further into this, it's time to post some code and

      your result of

      ver

      Heinrich

      #3; Sun, 18 May 2008 20:36:00 GMT
    • Heinrich Acker wrote:

      >

      > Hakan,

      > if I understand you correctly, it shouldn't be the way you

      > describe.

      > In the usual way to get the message (which is not an error),

      > pressing

      > enter in the command window changes nothing, except getting a new

      > line there.

      > In my example

      > for k=1:10

      > you can type enter as long as you want. The message stays there.

      > But

      > if you type

      > k, end

      > later, the incomplete statement is executed. When using this

      > functionality of the command window/editor/debugger, the same rules

      > apply when pressing F9.

      > You are right that this is not intended to go through a debug

      > session. But you can put additional commands interactively into a

      > debug session that way. So your system either has a problem, or you

      > missed something in aligning your statements, or you found a bug.

      > If you want to go further into this, it's time to post some code

      > and

      > your result of

      > ver

      > Heinrich

      Hi Heinrich,

      Sure, for your reference take this code for example:

      i = 1;

      for j = datenum('jan-01-1995'):today()

      if isbusday(j)

      bus_dates(:,i) = j;

      i = i+1;

      end

      end

      clear i j;

      As you can see, I only have 1 'for' and 1 'if' with 2 'end's (so I

      don't think there's any problem with this code).

      When I highlight these lines in the editor and press F9, in my

      Command Window (at the bottom left) it says:

      'Continue Entering Statement'

      That said, after slightly more than one second, it produces the

      bus_dates array no problem. Now it seems like it should say

      something like 'Busy' instead (as in when it runs normally).

      However, if I have many more sections of code just like this which I

      highlight and press F9, I cannot tell so easily if it is actually

      running something (meaning it should say 'Busy') or if it's found

      errors somewhere and so is expecting me to provide an 'end' or

      something like that in the Command Window. I don't remember

      encountering something like this in Matlab before (now I'm using

      Matlab 7.3.0 (R2006b)).

      Can you tell me if you also get this message for this simple code in

      your version?

      Thanks for your interest, by the way.

      -Hakan

      #4; Sun, 18 May 2008 20:38:00 GMT
    • Hakan Korkut wrote:

      >

      > Can you tell me if you also get this message for this simple code

      > in

      > your version?

      Hakan,

      I can't run your code as I don't have 'today' and 'isbusday'. But

      perhaps something else is interesting for you. I have observed that

      the status line is not always updated properly when Matlab is

      running. Sometimes the line is empty when Matlab is actually busy.

      You can force updating the line by pressing return in the command

      window. Is it possible that you have an old message there when

      executing large portions of highlighted code?

      Heinrich

      #5; Sun, 18 May 2008 20:39:00 GMT
    • Heinrich Acker wrote:

      >

      > Hakan Korkut wrote:

      code

      > Hakan,

      > I can't run your code as I don't have 'today' and 'isbusday'. But

      > perhaps something else is interesting for you. I have observed that

      > the status line is not always updated properly when Matlab is

      > running. Sometimes the line is empty when Matlab is actually busy.

      > You can force updating the line by pressing return in the command

      > window. Is it possible that you have an old message there when

      > executing large portions of highlighted code?

      > Heinrich

      Hi Heinrich,

      I think you are right - this status line does not always update

      properly and that is what is confusing me (and making me resort to

      hard returns in the Command Window). It's possible that maybe it's

      actually running my code despite what it displays without needing

      these returns (I will try to see if that's the case).

      As for the old messages, I don't believe so but I will also check

      these.

      Thanks so much for your help.

      -Hakan

      #6; Sun, 18 May 2008 20:40:00 GMT