How do I make a splash screen for my MATLAB GUI application?
19 views (last 30 days)
Show older comments
I would like to make a splash screen for my application, a window that pops up with a logo in it while my program is loading. I can make a figure pop up, but this has a menu and toolbar.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
The ability to create splash screens is not available in MATLAB.
As a workaround, the following code should produce an example figure window in the center of the screen:
% create a figure that is not visible yet, and has minimal titlebar properties
fh = figure('Visible','off','MenuBar','none','NumberTitle','off');
% put an axes in it
ah = axes('Parent',fh,'Visible','off');
% put the image in it
load earth.mat
ih = image(X,'parent',ah);
colormap(map)
% set the figure size to be just big enough for the image, and centered at
% the center of the screen
imxpos = get(ih,'XData');
imypos = get(ih,'YData');
set(ah,'Unit','Normalized','Position',[0,0,1,1]);
figpos = get(fh,'Position');
figpos(3:4) = [imxpos(2) imypos(2)];
set(fh,'Position',figpos);
movegui(fh,'center')
% make the figure visible
set(fh,'Visible','on');
ht = timer('StartDelay',5,'ExecutionMode','SingleShot');
set(ht,'TimerFcn','close(fh);stop(ht);delete(ht)');
start(ht);
Unfortunately, the blue bar at the top of the window and the standard window buttons will be present. This sample should automatically readjust for different window sizes.
0 Comments
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!