How to display the waitbar in the main GUI window

조회 수: 11 (최근 30일)
Mehdi Kooli
Mehdi Kooli 2022년 12월 7일
답변: Amit Dhakite 2023년 2월 17일
Hi,
I'm using Matlab R2015b.
I developed a GUI that when pushing the button "Analyser" , it displays a progress bar in another figure (see screen shot below).
I want to display this progress bar in the main window (progress bar to be merged), maybe by displaying it in a button or in axes !?
Here is my code :
% --- Executes on button press in Apply_Correction.
function Analyser_Callback(hObject, eventdata, handles)
%% hObject handle to Apply_Correction (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Starting the waitbar
h1 = waitbar(0,'Wait please...');
hw = findobj(h1,'Type','Patch');
set(hw,'EdgeColor',[0 1 0], 'FaceColor', [0 1 0])
% Calculation Here
%%%%%% Code part 1 %%%%%%
waitbar(0.3,h1) %%% filling the progress bar %%%
%%%%%% Code part 2 %%%%%%
waitbar(0.6,h1) %%% filling the progress bar %%%
%%%%%% Code part 3 %%%%%%
waitbar(1,h1) %%% filling the progress bar %%%
close(h1)
end

답변 (1개)

Amit Dhakite
Amit Dhakite 2023년 2월 17일
Hi Mehdi,
As per my understanding, you want to display your loader/waitbar in your main gui window.
You can do that by adding an HTML UI component in your app. When you want to show that loader, you can edit the value of its HTMLSource and then the value will be displayed in the main gui window itself.
An implementation of an example is attached here. You can edit it according to your requirements.
For further information about HTML UI component, kindly refer to the following link: https://www.mathworks.com/help/matlab/ref/uihtml.html

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by