File Exchange

image thumbnail


version 2.2.0 (5.2 KB) by Adam Danz
A solution to the problem of Matlab consuming an enormous amount of time to recover from an "Undefined function or variable" error.


Updated 17 Mar 2021

View Version History

View License

The "current folder history" stores paths to directories that were once current (it differs from the search path). When paths from networks end up on the current folder history and the network becomes unavailable, an undefined variable or function (often caused by a typo) may cause an unbearable delay in the error message to appear [1,2,3]. To alleviate this problem, this function produces a GUI that lists all paths on the current folder history and you can select which paths to remove from the history. The GUI will create a backup of your original history in case you want to restore it.

This was initially developed in Matlab r2017b and does not work with previous releases but the problem did not occur prior to then anyway. Latest release updated in r2021a.

To participate in discussions on this topic, mention me (@Adam Danz) in link #2 below.


Cite As

Adam Danz (2021). removeDrivesFromHistory (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (19)

Tom Hartley


Conor Sullivan

Fantastic! Thank you so much!!!

Sterling Thompson

Took me forever to figure out why MATLAB was getting hung up and once I did, I was able to fix it quickly with this. Saved me from a major headache!



You are fixing Matlab's problems for them! Thank you.

Stelios Stefanatos

Bryan Ruane

Thank you so much, I was losing so much time to this issue!

Darjn Esposito

Thank you!!!!!!

David Meijer

Emilia Lalander

Solved my problem!!

David Pate

Mark Kemp

Kevin Miller


Thanks! Your code tremendously reduced the amount of delay! I also use Mac, and it does not have this problem at all.

Michael Liedlgruber

Simon Musall


Chang hsiung

MATLAB Release Compatibility
Created with R2017b
Compatible with R2017b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!