How to display the waitbar in the main GUI window

11 views (last 30 days)
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

Answers (1)

Amit Dhakite
Amit Dhakite on 17 Feb 2023
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

Categories

Find more on Dialog Boxes in Help Center and File Exchange

Products


Release

R2015b

Community Treasure Hunt

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

Start Hunting!