Reputation: 3574
I have lost the location of a .m
file I recently wrote with the Matlab editor. I don't remember how I named it so the usual finder search is not helping.
The Matlab editor lets me open 'recent files' but only the few newest. Is there a way to recover a longer list of recently opened files?
Upvotes: 2
Views: 8127
Reputation: 112699
That information seems to be stored in the Matlab preference folder. That folder is given by the function prefdir
.
Specifically, the file 'matlab.prf'
seems to contain the list of recent files. To open that file and inspect it manually you can use
open(fullfile(prefdir, 'matlab.prf'))
Recent file information seems to be contained in lines beginning with EditorMRU
. I have observed that in R2010b and R2014b. Other Matlab versions may behave differently.
You could also programmatically read that file with importdata
,
x = importdata(fullfile(prefdir, 'matlab.prf')); %// R2010b or R2014b
x = x.textdata; %// include this line if using R2014b; not if using 2010b
This gives x
as a cell array of strings, where each string is a line of that file. Then look for lines containing the substring 'EditorMRU'
:
y = x(~cellfun(@isempty, strfind(x, 'EditorMRU')));
I don't know how many recent file names are stored, though.
Upvotes: 2