Change width of the bar figure at waitbar - MATLAB R2015a

23 visualizaciones (últimos 30 días)
Hari Steri
Hari Steri el 1 de Abr. de 2016
Comentada: Oriel Nofekh el 13 de En. de 2020
How could I control the width of the percentage bar inside a waitbar in Matlab R2015a? I tried using the following command:
childrenWaitb = get(HWait, 'Children') ;
set(childrenWaitb, 'Position',[10.8000 13.5000 320 9]);
It works perfectly in Matlab R2012b, but in R2015a the 'Waitbar' string is placed in the middle, and the percentage bar does not change width at all....
The complete code I used is below:
HWait = waitbar(0,'Waitbar 1', 'Units', 'normalized', 'Position', [0.25 0.4 0.3 0.08]);
set(HWait,'Name','Tests running');
childrenWaitb = get(HWait, 'Children') ;
set(childrenWaitb, 'Position',[10.8000 13.5000 320 9]);

Respuesta aceptada

Orion
Orion el 1 de Abr. de 2016
Hi,
Here is one way to do it :
% Create the waitbar
HWait = waitbar(0,'Waitbar 1','Name','Tests running');
% Change the Units Poreperty of the figure and all the children
set(findall(HWait),'Units', 'normalized');
% Change the size of the figure
set(HWait,'Position', [0.25 0.4 0.3 0.08]);
  2 comentarios
Hari Steri
Hari Steri el 1 de Abr. de 2016
That worked perfectly, thank you!!
Oriel Nofekh
Oriel Nofekh el 13 de En. de 2020
It worked great, I used it in my code.
Until in R2019b they decided that changing the size of the waitbar after it is created/presented will cause an error.
I'm now trying to find a workaround to this (since I'd like to first create it, then use its default position as a base to changes). Maybe I'll just create a waitbar, take its position value, destroy it and create a new one.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Dialog Boxes en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by