从Matlab编辑器中恢复最近文件的较长列表 [英] Recover a longer list of recent files from the Matlab editor

查看:282
本文介绍了从Matlab编辑器中恢复最近文件的较长列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我丢失了最近用Matlab编辑器编写的.m文件的位置.我不记得我是怎么命名的,所以通常的取景器搜索无济于事.

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.

Matlab编辑器允许我打开最近的文件",但只有少数最新文件.有办法恢复最近打开的文件的较长列表吗?

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?

推荐答案

该信息似乎存储在 Matlab首选项文件夹.该文件夹由功能 prefdir 给出. 具体来说,文件'matlab.prf'似乎包含最新文件的列表.要打开该文件并进行手动检查,您可以使用

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'))

最近的文件信息似乎包含在以EditorMRU开头的行中.我在R2010b和R2014b中观察到了这一点.其他Matlab版本的行为可能有所不同.

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.

您还可以使用 importdata 以编程方式读取该文件,

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

这给出x作为字符串的单元格数组,其中每个字符串都是该文件的一行.然后查找包含子字符串'EditorMRU':

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.

这篇关于从Matlab编辑器中恢复最近文件的较长列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆