Post Image
By Matt GaidicaJanuary 15, 2019In Uncategorized

List or Edit Recently Modified Files in MATLAB

Git is a good way to keep track of file changes and integrates with MATLAB but doesn’t quickly tell you what files you have been working on. The MATLAB editor has persistence after closing (so that files will re-open in tabs) and Open > RECENT FILES is good to see where you left off. If you ever mistakenly close all tabs, MATLAB actually keeps record of your workspace and you can recover it. However, if want to hop back into a file from days ago or work across machines, the workflow is subpar.

workon.m will list the n most recently edited files in the current directory (recursively) and then let you open one, or many of those files for editing.

>> workon
[01] --> entrainment_HighResolution.m (now)
[02] --> workon.m (now)
[03] --> Ray_LFPspikeCorr.m (3 hours ago)
[04] --> wholeSessionPowerCorr.m (18 hours ago)
[05] --> deltaPhaseSpiking_wBeta.m (5 days ago)
[06] --> deltaPhaseBetaEvents.m (6 days ago)
[07] --> run_code.m (6 days ago)
[08] --> entrainmentTrialShuffle.m (6 days ago)
[09] --> dklPeakDetect.m (7 days ago)
[10] --> deltaRTchaos_simpleCorr.m (8 days ago)
[11] --> Leventhal2012_Fig6_spikePhaseHist_allFreqs.m (15 days ago)
[12] --> ff.m (15 days ago)
[13] --> periEventTrialTs.m (15 days ago)
[14] --> eventsLFPv2.m (15 days ago)
[15] --> spectrum_MRL.m (18 days ago)

Next, you can open any number of those files by passing in a single integer (for one file) or an integer vector of all the files you want to open. For instance, to open the 7 most recently edited files in the MATLAB editor:

>> workon(1:7)

svgM-file Task List from MATLAB Comments
svgTime Cost of Initializing Arrays in MATLAB