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:
waitbar with 2 bars

Subject: waitbar with 2 bars

From: Gavrilo Bozovic

Date: 7 Nov, 2008 13:49:02

Message: 1 of 3

Hi!

I have a function that runs for a long time, with two imbricated for loops.

Is it possible to have a waitbar window with two waitbars, one showing the progression within the first loop, and one within the imbricated one?

Thanks in advance!

Subject: waitbar with 2 bars

From: Steven Lord

Date: 7 Nov, 2008 14:49:55

Message: 2 of 3


"Gavrilo Bozovic" <gavrilo.bozovic@helbling.ch> wrote in message
news:gf1h0e$8d5$1@fred.mathworks.com...
> Hi!
>
> I have a function that runs for a long time, with two imbricated for
> loops.
>
> Is it possible to have a waitbar window with two waitbars, one showing the
> progression within the first loop, and one within the imbricated one?

Not without creating a modified WAITBAR function and tweaking it to do what
you've described. However, you can do something similar to what you've
described:


h1 = waitbar(0, 'Waitbar 1', 'Units', 'normalized', 'Position', [0.25 0.4
0.25 0.2]);
for k = 1:10
    waitbar(k/10, h1);
    pause(0.1)
    h2 = waitbar(0, 'Waitbar 2', 'Units', 'normalized', 'Position', [0.5 0.4
0.25 0.2]);
    for m = 1:20
        waitbar(m/20, h2);
        pause(0.1)
    end
    close(h2)
end


--
Steve Lord
slord@mathworks.com

Subject: waitbar with 2 bars

From: Gavrilo Bozovic

Date: 10 Nov, 2008 09:07:01

Message: 3 of 3

"Steven Lord" <slord@mathworks.com> wrote in message <gf1kij$mj6$1@fred.mathworks.com>...
>
> "Gavrilo Bozovic" <gavrilo.bozovic@helbling.ch> wrote in message
> news:gf1h0e$8d5$1@fred.mathworks.com...
> > Hi!
> >
> > I have a function that runs for a long time, with two imbricated for
> > loops.
> >
> > Is it possible to have a waitbar window with two waitbars, one showing the
> > progression within the first loop, and one within the imbricated one?
>
> Not without creating a modified WAITBAR function and tweaking it to do what
> you've described. However, you can do something similar to what you've
> described:
>
>
> h1 = waitbar(0, 'Waitbar 1', 'Units', 'normalized', 'Position', [0.25 0.4
> 0.25 0.2]);
> for k = 1:10
> waitbar(k/10, h1);
> pause(0.1)
> h2 = waitbar(0, 'Waitbar 2', 'Units', 'normalized', 'Position', [0.5 0.4
> 0.25 0.2]);
> for m = 1:20
> waitbar(m/20, h2);
> pause(0.1)
> end
> close(h2)
> end
>
>
> --
> Steve Lord
> slord@mathworks.com
>

hi Steve!

Thanks for your answer, that will do the trick for my application!

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