How do I make a splash screen for my MATLAB GUI application?

5 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 27 de Jun. de 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.

Más respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by