Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Return to CommandWindow after plot a figure

Subject: Return to CommandWindow after plot a figure

From: Ramzi

Date: 12 Feb, 2011 04:11:56

Message: 1 of 13

At the top of my script I put
commandwindow;
so I can watch my program execution from the text I have sent by
fprintf commands.
Now when the execution reach to plot command it view the figure and
doesn't return to command window.
I try to put commandwindow; after the plot command but it doesn't
work. What should I do?
Thanks

Subject: Return to CommandWindow after plot a figure

From: ImageAnalyst

Date: 12 Feb, 2011 04:18:31

Message: 2 of 13

Maybe you should try "echo on" instead.

Subject: Return to CommandWindow after plot a figure

From: Ramzi

Date: 12 Feb, 2011 04:51:00

Message: 3 of 13

On Feb 12, 5:18 am, ImageAnalyst <imageanal...@mailinator.com> wrote:
> Maybe you should try "echo on" instead.

echo on will display the command under execution and doesn't return
you from the figures to the command window. Thanks

Subject: Return to CommandWindow after plot a figure

From: ImageAnalyst

Date: 12 Feb, 2011 05:10:42

Message: 4 of 13

On Feb 11, 11:51 pm, Ramzi <ramz...@gmail.com> wrote:
> On Feb 12, 5:18 am, ImageAnalyst <imageanal...@mailinator.com> wrote:
>
> > Maybe you should try "echo on" instead.
>
> echo on will display the command under execution and doesn't return
> you from the figures to the command window. Thanks

------------------------------------------------------------------------
Sorry, I didn't read closely enough. I thought you wanted to watch
your program execution in the command window. But you really wanted
to shift "focus" back to the command window after you're done
plotting. The key word to use in situations like this is "focus."
Focus means which GUI control is the default one - like where the
cursor is. I didn't find any way to do that with standard MATLAB
commands. But you might search Yair's website:

http://undocumentedmatlab.com/blog/fixing-a-java-focus-problem/
http://undocumentedmatlab.com/blog/detecting-window-focus-events/

Subject: Return to CommandWindow after plot a figure

From: Ramzi

Date: 12 Feb, 2011 15:11:24

Message: 5 of 13

On Feb 12, 6:10 am, ImageAnalyst <imageanal...@mailinator.com> wrote:
> On Feb 11, 11:51 pm, Ramzi <ramz...@gmail.com> wrote:
>
> > On Feb 12, 5:18 am, ImageAnalyst <imageanal...@mailinator.com> wrote:
>
> > > Maybe you should try "echo on" instead.
>
> > echo on will display the command under execution and doesn't return
> > you from the figures to the command window. Thanks
>
> ------------------------------------------------------------------------
> Sorry, I didn't read closely enough.  I thought you wanted to watch
> your program execution in the command window.  But you really wanted
> to shift "focus" back to the command window after you're done
> plotting.  The key word to use in situations like this is "focus."
> Focus means which GUI control is the default one - like where the
> cursor is.  I didn't find any way to do that with standard MATLAB
> commands.  But you might search Yair's website:
>
> http://undocumentedmatlab.com/blog/fixing-a-java-focus-problem/http://undocumentedmatlab.com/blog/detecting-window-focus-events/

Yesterday, I did that as following:
H=figure(...);
plot(...);
set(H,'Visible','Off');
... continue my program execution
set(H,'Visible','On');

What is your opinion?

Subject: Return to CommandWindow after plot a figure

From: ImageAnalyst

Date: 12 Feb, 2011 15:25:36

Message: 6 of 13

I don't think that would shift focus to the command window, but it
would make it visible. If that does what you want, then fine. You
can also resize with the set(H, 'position', positionArray) command.

Subject: Return to CommandWindow after plot a figure

From: Ramzi

Date: 12 Feb, 2011 15:35:42

Message: 7 of 13

On Feb 12, 4:25 pm, ImageAnalyst <imageanal...@mailinator.com> wrote:
> I don't think that would shift focus to the command window, but it
> would make it visible.  If that does what you want, then fine.  You
> can also resize with the set(H, 'position', positionArray) command.

It is not only works perfectly, but also gives you a control in which
order you want to display your figures if you have many.

Subject: Return to CommandWindow after plot a figure

From: Yair Altman

Date: 12 Feb, 2011 16:34:04

Message: 8 of 13

Ramzi <ramzib2@gmail.com> wrote in message <f84d9472-5b91-45dc-a647-59ca9c82995e@o10g2000vbg.googlegroups.com>...
> On Feb 12, 4:25 pm, ImageAnalyst <imageanal...@mailinator.com> wrote:
> > I don't think that would shift focus to the command window, but it
> > would make it visible.  If that does what you want, then fine.  You
> > can also resize with the set(H, 'position', positionArray) command.
>
> It is not only works perfectly, but also gives you a control in which
> order you want to display your figures if you have many.


There is also the keyboard command, if you are interested...

Yair Altman
http://UndocumentedMatlab.com

Subject: Return to CommandWindow after plot a figure

From: Miroslav Balda

Date: 13 Feb, 2011 09:31:05

Message: 9 of 13

Hi,
There is yet another solution for displaying command window after plotting:

plot(....)
drawnow
commandwindow

Mira

Subject: Return to CommandWindow after plot a figure

From: Ramzi

Date: 14 Feb, 2011 00:48:47

Message: 10 of 13

On Feb 13, 10:31 am, "Miroslav Balda" <miroslav.nos...@balda.cz>
wrote:
> Hi,
> There is yet another solution for displaying command window after plotting:
>
> plot(....)
> drawnow
> commandwindow
>
> Mira

Thanks Mera, it works, but for my program as it contains many figures
and I want to reorder them, I find to make an array of figure-handles,
and use visible property is very suitable.

Subject: Return to CommandWindow after plot a figure

From: Boris

Date: 1 Sep, 2011 16:48:10

Message: 11 of 13

"Yair Altman" wrote in message <ij6cpr$ndb$1@fred.mathworks.com>...
> Ramzi <ramzib2@gmail.com> wrote in message <f84d9472-5b91-45dc-a647-59ca9c82995e@o10g2000vbg.googlegroups.com>...
> > On Feb 12, 4:25 pm, ImageAnalyst <imageanal...@mailinator.com> wrote:
> > > I don't think that would shift focus to the command window, but it
> > > would make it visible.  If that does what you want, then fine.  You
> > > can also resize with the set(H, 'position', positionArray) command.
> >
> > It is not only works perfectly, but also gives you a control in which
> > order you want to display your figures if you have many.
>
>
> There is also the keyboard command, if you are interested...
>
> Yair Altman
> http://UndocumentedMatlab.com

Hi Yair,
Can you elucidate further? I too have code that generates a few (sometimes quite large) plots and also gives status hints in the command window so was looking for a way of suppressing the figure windows from taking focus (or at least returning to the command window focus immediately after the figure windows are created). I could make the figures invisible but do not think that is a very elegant solution. And I do not want to wait for the plot to finish (can take several 10's of seconds) before returning to the command window either.

Many thanks for any help you can provide (and thanks too for all your interesting posts on undcumentedmatlab - I have been playing with cprintf but find it a little unpredicatble when you write and then delete lots of text streams).

Best wishes, Boris.

Subject: Return to CommandWindow after plot a figure

From: ARAVETI sandeep

Date: 23 Sep, 2011 07:07:13

Message: 12 of 13

use commandwindow after plotting figure;
example

figure;
contour(peaks(20));
commandwindow;





Ramzi <ramzib2@gmail.com> wrote in message <bac6104c-ab31-4e69-b9f8-2c31a6a3b2f9@g11g2000vbq.googlegroups.com>...
> At the top of my script I put
> commandwindow;
> so I can watch my program execution from the text I have sent by
> fprintf commands.
> Now when the execution reach to plot command it view the figure and
> doesn't return to command window.
> I try to put commandwindow; after the plot command but it doesn't
> work. What should I do?
> Thanks

Subject: Return to CommandWindow after plot a figure

From: Miroslav Balda

Date: 27 Sep, 2011 13:22:14

Message: 13 of 13

"ARAVETI sandeep" wrote in message <j5hb71$3nq$1@newscl01ah.mathworks.com>...
> use commandwindow after plotting figure;
> example
>
> figure;
> contour(peaks(20));
> commandwindow;

 SNIP

Sometimes, you need to use the command "drawnow" before calling commandwindow.

Mira

Tags for this Thread

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.

Contact us