Slow Matlab startup if startup.m contains many path additions
Show older comments
I am asking/answering my own question, hoping it will help someone with the same issue:
If Matlab takes 3+ minutes to start up, how can I speed it up? My startup.m file contains many calls to add directories to my path, and those directories reside on a network drive. For example:
path(path, 'S:\top_code_directory\some_subdirectory') ; % Many calls like this
path(path, genpath('S:\project_directories')) ; % Many subdirectories are added
1 Comment
Accepted Answer
More Answers (1)
3 Comments
Richard Crozier
on 4 Oct 2012
Well, this is ok, as long as the path directory structure never changes, and you have write permission to the directory where the path is saved, which in my case I don't, and don't want your startup script to be portable between different machines. Why not just do it throught the Set Path dialog in this case and choose save?
The real problem here is that calls to path.m are very slow.
Robert Cumming
on 4 Oct 2012
By doing it this way every user of your machine will also have all your paths added. Be careful as you may not want this...
Richard Crozier
on 4 Oct 2012
No, only users who have access to my startup directory which is only accessible to me, so they have to also be logged in as me. Valid point for others though. I've discovered the real answer to the problem anyway which I have posted below.
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!