필터 지우기
필터 지우기

Display wait bar in Static text box in GUIDE

조회 수: 1 (최근 30일)
JB
JB 2016년 1월 26일
댓글: Statisticalbeginner 2016년 2월 24일
Hello,
I have seen many posts regarding displaying a Gui for waitbar/progress bar.
I am interested in showing progress bar in a static text box WITH IN my GUI interface.
Any help regarding this will be highly appreciated.
  댓글 수: 5
JB
JB 2016년 1월 26일
I have used builtin 'waitbar', unfortunately. As i have no idea of how make a progress bar.
Can you please kindly help me out, how to display a progress bar in static text box.?
Walter Roberson
Walter Roberson 2016년 1월 26일
waitbar() uses graphics, an axes within a figure. You cannot display a graphics within a static text box.
Are you aiming for a graphical wait bar, or are you aiming for something that updates a text percentage?

댓글을 달려면 로그인하십시오.

답변 (1개)

Matthew
Matthew 2016년 1월 26일
편집: Matthew 2016년 1월 26일
I just go with a java progress bar when I want to put a progress bar in a GUI.
%Create a Progress bar with a range from 0 to 100
jBarHandle = javax.swing.JProgressBar(0, 100);
jBarHandle.setStringPainted(true);
jBarHandle.setIndeterminate(false);
%You need a pixel position for where to put the bar, I tend to do this by finding a reference object in the GUI that I'm going to replace.
posPanel = getpixelposition(someReferenceObject,true);
%Place the progress bar in the GUI
javacomponent(jBarHandle,posPanel,guiFigureHandle);
%Set the value of the progress bar.
jBarHandle.setValue(fix(0));
For full information on the properties available with JProgressBar here's the link.
If you really wanted to use waitbar, you could probably either modify the builtin function, or use the built-in function and clone the axes into your own GUI. Either way though, that seems a fair bit more complicated then just going with java swing.
  댓글 수: 3
Adam
Adam 2016년 1월 27일
Basically this would be an the equivalent of the static text you want to add. If you are using an actual progress bar like above then you would be best creating a panel of the size and position you want rather than a static text, then use that in Matthew's answer above to provide the correct position.
Statisticalbeginner
Statisticalbeginner 2016년 2월 24일
Great answer. One additional thing I want to ask is how do you show the progress after displaying the progress bar ? How do you pass the "Value" to it? jBarHandle.setValue(update_value); consider update_value is holding the progress value.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by