View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

4.6 | 14 ratings Rate this file 18 Downloads (last 30 days) File Size: 146 KB File ID: #30508 Version:
image thumbnail



Ben Tordoff (view profile)


23 Feb 2011 (Updated )

Show a splash-screen during MATLAB application start-up.

| Watch this File

File Information

This class provides a splash-screen that you can show as your MATLAB application starts:
 * Border-less window
 * Ability to add text overlays
 * Optional progress bar with configurable location

This is mainly useful when deploying applications using the MATLAB compiler and where your application takes a while to initialize.

Requires MATLAB R2010a or above.

MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (23)
07 Dec 2016 Kevin Ernesto Paredes Gutierrez

??? Error using ==> SplashScreen>SplashScreen.SplashScreen at 56
Syntax error. You must supply both a window title and imagename.

How can i fix it?

Comment only
29 Aug 2016 Guy Championnet

Perfect, but especially if used as a progress bar, the window might not appear on top of the other windows, to deal with that:

after line 250 add:

and after line 311 add:

09 Apr 2016 LITO Plzen

29 Dec 2014 David

David (view profile)


At line 244, you can modify the code to accommodate the second monitor. Something like:

% Old code start here:
% Resize and reposition the window
obj.Frame.setSize( obj.Icon.getIconWidth(), obj.Icon.getIconHeight() );
% pos = get(0,'MonitorPositions');
% x0 = pos(1,1) + (pos(1,3)-obj.Icon.getIconWidth())/2
% y0 = pos(1,2) + (pos(1,4)-obj.Icon.getIconHeight())/2

% New Code starts here:
screensize = get(0,'ScreenSize');
w = obj.Frame.getWidth();
h = obj.Frame.getHeight();
x0 = ceil((screensize(3)-w)/2);
y0 = ceil((screensize(4)-h)/2);

obj.Frame.setLocation( x0, y0 );

04 Sep 2014 Song

Song (view profile)

perfect !!!!!!!! I love it !!!!

04 Feb 2014 Ben Tordoff

Ben Tordoff (view profile)

Right now there isn't a way to set the position programmatically. I guess I could make it settable. However, it should be picking the first monitor and centering the window there. Could you post the output of get(0,'MonitorPositions')?


Comment only
03 Feb 2014 Jun Guo

Hi Ben, thanks a lot for this file.

I have a problem displaying the splashscreen, as I have two monitors set as "extended" display. Once the SplashScreen runs, the screen shows "in the middle" of the two monitors, i.e., half of the splashscreen is in Monitor A and another half in Monitor B.

Is there any setting to position the splashscreen on the monitor?

24 Sep 2013 Paulo Ferreira

11 Jul 2013 Shivaputra Narke

If I use GUIDE to generate the GUI, where should I call
s = SplashScreen(...);
and when should I call

Comment only
11 Jul 2013 Shivaputra Narke

13 Feb 2013 Ben Tordoff

Ben Tordoff (view profile)

OK, that's a little surprising. Maybe try putting a "drawnow" after opening it?

You are right that nothing will be shown until the MCR has been loaded/initialized. The only way around that is to write a wrapper around your executable that shows the splashscreen before launching the MATLAB deployed app. Obviously that would have to be written in something other than MATLAB (which requires the MCR!).

Comment only
12 Feb 2013 Dahai Xue

Hi Ben,
I am trying to use this for compiled programs and hope this will show up soon after the program icon is clicked. In general, it will take a while before anything can happen on the screen, probably because MCR has to be loaded. In my case, the program also goes to look for the paths of file I/O that are saved from the previous session. When I call this in the _OpeningFcn(), it did not show up until close to the end of waiting time. Wonder if there is a solution for it?
Thank you.

Comment only
07 Feb 2013 Ben Tordoff

Ben Tordoff (view profile)

Hi Canoe Commuter (great name, by the way - beats using the car!), the simple way to make the splashscreen stay up for a second or two is to use "pause(1)" (for 1 second) or similar. However this will block, not allowing anything else to happen, which may get annoying.

A slightly more sophisticated approach is to ensure it stays up for N seconds. In psuedo-code this might look something like:

showSplashForSecs = 2;

timer = tic;
elapsedTime = toc(timer);
if elapsedTime < showSplashForSecs
pause(showSplashForSecs - elapsedTime);

This should ensure that the splashscreen is always on for at least two seconds even if your application initializes really quickly. It will still block interaction whilst paused though.

Comment only
06 Feb 2013 Canoe Commuter

Great file! Thank you for sharing.

Problem: My application loads so fast there's no chance to read the splash screen. How can I make the screen stay up for a finite amount of time?

For others who are (like me) not experienced programmers: by trial-and-error I found that you insert the calling code into the GUI function called (your function's name)OpeningFcn.

06 Feb 2013 Dahai Xue

Very nice. Quick question: If I use GUIDE to generate the GUI, where should I call
s = SplashScreen(...);
and when should I call

28 Nov 2011 Ben Tordoff

Ben Tordoff (view profile)

Hi Andre, you must call this with a name for the window (i.e. a title) and the name of the image file you want it to show. For example: "s = SplashScreen('My App','myAppImage.png')". Type "help SplashScreen" for more information. If that still doesn't help you, let me know.


Comment only
26 Nov 2011 Andre Asfar

I have an error:

"Syntax error. You must supply both a window title and imagename"

What should I do?

Comment only
04 Oct 2011 Sim

Sim (view profile)

Nice addition, thank you!

I have a problem in my standalone application: the application hangs when executing the 'delete(s)' command (the splash screen disappears before crashing). Do you have an idea why?

My workaround is to hide the splash screen instead:


09 Jun 2011 Julián Francisco

09 Mar 2011 Christophe Tilman

09 Mar 2011 Christophe Tilman

Very nice.
Only one remark about figure position.
On my computer, root 'MonitorPositions' return [left,bottom,right,up] for each monitor instead of [left,bottom, width, height] as described in the matlab documentation.

so, I had to replace line 247 & 248 by those:
x0 = pos(1,1) + (diff(pos(1,[1 3]))-obj.Icon.getIconWidth())/2
y0 = pos(1,2) + (diff(pos(1,[2 4]))-obj.Icon.getIconHeight())/2

Note that this is not an issue if you use only one monitor or if your primary monitor is on the left of the secondary.

08 Mar 2011 Ben Tordoff

Ben Tordoff (view profile)

Hi Dani, an update allowing the text shadows to be turned off is on its way. I don't think the Java tools I'm using allow animated GIFs to be viewed, so I don't think that can be supported in any easy way.

Cheers. Ben

Comment only
03 Mar 2011 Dani

Dani (view profile)

Really, really nice - I wish I had it earlier.

Two questions:

1. Why can I not load animated GIFs? This would allow for even more dynamic splash screens.

2. It would be nice if one could control (deactivate) the text shadow, i.e. lines 100-110.

08 Mar 2011 1.1

* Allow text shadows to be turned off
* Improve help for adding text

01 Sep 2016

Updated license

Contact us