Got Questions? Get Answers.
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:
onscreen output problem

Subject: onscreen output problem

From: Yuri Geshelin

Date: 27 Nov, 2008 19:28:02

Message: 1 of 9

Here is a simple line:

for i = 1:10, for j = 1:1e7, end, i, end

If I execute it in unix, I get what I expect, i.e.

i =

     1


i =

     2

pops up every 2 seconds. However, under Windows XP, the effect is different: matlab waits till the external loop is completed, then spits out the entire output. I don't like it, I want my program to display interim results at each pass of the loop. How can I do it?

Thanks.

Subject: onscreen output problem

From: Walter Roberson

Date: 27 Nov, 2008 19:48:31

Message: 2 of 9

Yuri Geshelin wrote:
> Here is a simple line:

> for i = 1:10, for j = 1:1e7, end, i, end
>
> If I execute it in unix, I get what I expect, i.e.
> pops up every 2 seconds. However, under Windows XP, the effect is different: matlab waits
> till the external loop is completed, then spits out the entire output. I don't like it,
> I want my program to display interim results at each pass of the loop. How can I do it?

Consider using pause()

--
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Subject: onscreen output problem

From: Yuri Geshelin

Date: 27 Nov, 2008 19:59:02

Message: 3 of 9

Walter Roberson <roberson@hushmail.com> wrote in message <fQCXk.94$4c1.34@newsfe25.iad>...
> Yuri Geshelin wrote:
> > Here is a simple line:
>
> > for i = 1:10, for j = 1:1e7, end, i, end
> >
> > If I execute it in unix, I get what I expect, i.e.
> > pops up every 2 seconds. However, under Windows XP, the effect is different: matlab waits
> > till the external loop is completed, then spits out the entire output. I don't like it,
> > I want my program to display interim results at each pass of the loop. How can I do it?
>
> Consider using pause()
>
> --
> .signature note: I am now avoiding replying to unclear or ambiguous postings.
> Please review questions before posting them. Be specific. Use examples of what you mean,
> of what you don't mean. Specify boundary conditions, and data classes and value
> relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Thanks Walter,

But then I have to hit ENTER every time. This does not solve my problem. I want to be away from PC, then come back and see something like

100 iterations completed; 9 solutions found
200 iterations completed; 12 solutions found
300 iterations completed; 14 solutions found
400 iterations completed; 17 solutions found
............

This works in unix, why does it not under windows? Or maybe it is not an operational system issue?

Yuri

Subject: onscreen output problem

From: Yuri Geshelin

Date: 27 Nov, 2008 20:13:02

Message: 4 of 9

"Yuri Geshelin" <geshelin@hotmail.com> wrote in message <ggmsc2$opb$1@fred.mathworks.com>...
> Here is a simple line:
>
> for i = 1:10, for j = 1:1e7, end, i, end
>
> If I execute it in unix, I get what I expect, i.e.
>
> i =
>
> 1
>
>
> i =
>

I just noticed something: I said it works in unix, but this is only true when I launch matlab with -nodesktop option. Once I get the desktop, it is the same as in windows, i.e. the whole output is suppressed until the operations completes.

> 2
>
> pops up every 2 seconds. However, under Windows XP, the effect is different: matlab waits till the external loop is completed, then spits out the entire output. I don't like it, I want my program to display interim results at each pass of the loop. How can I do it?
>
> Thanks.

Subject: onscreen output problem

From: Walter Roberson

Date: 27 Nov, 2008 20:15:47

Message: 5 of 9

Yuri Geshelin wrote:
> Walter Roberson <roberson@hushmail.com> wrote in message <fQCXk.94$4c1.34@newsfe25.iad>...

>> Consider using pause()

> Thanks Walter,
>
> But then I have to hit ENTER every time.

Not if you pass a value to pause, such as pause(2)

> This does not solve my problem. I want to be away from PC, then come back and see something like
>
> 100 iterations completed; 9 solutions found
> 200 iterations completed; 12 solutions found
> 300 iterations completed; 14 solutions found
> 400 iterations completed; 17 solutions found
> ............
>
> This works in unix, why does it not under windows?

Sorry, I don't use Matlab under Windows so I don't have any explanation.

--
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Subject: onscreen output problem

From: Yuri Geshelin

Date: 27 Nov, 2008 20:51:01

Message: 6 of 9

Walter Roberson <roberson@hushmail.com> wrote in message <PdDXk.1120$yB5.432@newsfe21.iad>...
> Yuri Geshelin wrote:
> > Walter Roberson <roberson@hushmail.com> wrote in message <fQCXk.94$4c1.34@newsfe25.iad>...
>
> >> Consider using pause()
>
> > Thanks Walter,
> >
> > But then I have to hit ENTER every time.
>
> Not if you pass a value to pause, such as pause(2)
>
> > This does not solve my problem. I want to be away from PC, then come back and see something like
> >
> > 100 iterations completed; 9 solutions found
> > 200 iterations completed; 12 solutions found
> > 300 iterations completed; 14 solutions found
> > 400 iterations completed; 17 solutions found
> > ............
> >
> > This works in unix, why does it not under windows?
>
> Sorry, I don't use Matlab under Windows so I don't have any explanation.
>
> --
> .signature note: I am now avoiding replying to unclear or ambiguous postings.
> Please review questions before posting them. Be specific. Use examples of what you mean,
> of what you don't mean. Specify boundary conditions, and data classes and value
> relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

All right then, do you or anyone have an explanation for unix? As I said, I just discovered that it won't work in unix either, unless you specify a -nodesktop option.

Thanks

Subject: onscreen output problem

From: Walter Roberson

Date: 27 Nov, 2008 21:59:52

Message: 7 of 9

Yuri Geshelin wrote:
> Walter Roberson <roberson@hushmail.com> wrote in message <PdDXk.1120$yB5.432@newsfe21.iad>...
>> Yuri Geshelin wrote:
>>> Walter Roberson <roberson@hushmail.com> wrote in message <fQCXk.94$4c1.34@newsfe25.iad>...
>>>> Consider using pause()
>>> Thanks Walter,
>>>
>>> But then I have to hit ENTER every time.
>> Not if you pass a value to pause, such as pause(2)
>>
>>> This does not solve my problem. I want to be away from PC, then come back and see something like
>>>
>>> 100 iterations completed; 9 solutions found
>>> 200 iterations completed; 12 solutions found
>>> 300 iterations completed; 14 solutions found
>>> 400 iterations completed; 17 solutions found
>>> ............
>>>
>>> This works in unix, why does it not under windows?
>> Sorry, I don't use Matlab under Windows so I don't have any explanation.
>>
>> --
>> .signature note: I am now avoiding replying to unclear or ambiguous postings.
>> Please review questions before posting them. Be specific. Use examples of what you mean,
>> of what you don't mean. Specify boundary conditions, and data classes and value
>> relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?
>
> All right then, do you or anyone have an explanation for unix? As I said, I just discovered that it won't work in unix either, unless you specify a -nodesktop option.
>
> Thanks
>


--
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Subject: onscreen output problem

From: Walter Roberson

Date: 27 Nov, 2008 22:05:30

Message: 8 of 9

Yuri Geshelin wrote:
> I want to be away from PC, then come back and see something like
>
> 100 iterations completed; 9 solutions found
> 200 iterations completed; 12 solutions found
> 300 iterations completed; 14 solutions found
> 400 iterations completed; 17 solutions found

The following both work for me in Linux in the desktop

for i = 1 : 20; disp(i); pause(2); end

for i = 1 : 20; i, pause(2); end


However,

for i = 1 : 20; i, for j = 1:1e7;end; end

does display everything at the end. I suspect this to be due to
the Just In Time (JIT) compiler. But the following works:

for i = 1 : 20; i, pause(0), for j = 1:1e7;end; end

--
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Subject: onscreen output problem

From: Yuri Geshelin

Date: 28 Nov, 2008 00:12:01

Message: 9 of 9

Walter Roberson <roberson@hushmail.com> wrote in message <FQEXk.5080$no6.3928@newsfe04.iad>...
> Yuri Geshelin wrote:
> > I want to be away from PC, then come back and see something like
> >
> > 100 iterations completed; 9 solutions found
> > 200 iterations completed; 12 solutions found
> > 300 iterations completed; 14 solutions found
> > 400 iterations completed; 17 solutions found
>
> The following both work for me in Linux in the desktop
>
> for i = 1 : 20; disp(i); pause(2); end
>
> for i = 1 : 20; i, pause(2); end
>
>
> However,
>
> for i = 1 : 20; i, for j = 1:1e7;end; end
>
> does display everything at the end. I suspect this to be due to
> the Just In Time (JIT) compiler. But the following works:
>
> for i = 1 : 20; i, pause(0), for j = 1:1e7;end; end
>
> --
> .signature note: I am now avoiding replying to unclear or ambiguous postings.
> Please review questions before posting them. Be specific. Use examples of what you mean,
> of what you don't mean. Specify boundary conditions, and data classes and value
> relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Thanks Walter,

The key thing that I was missing is zero between the brackets. As long as it is there, I don't have to hit ENTER...

Yuri

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