许多网络浏览器都允许撤销关闭的选项卡:
在Matlab的编辑器中是否可以撤销关闭的选项卡?
我使用的是Windows 7上的R2014a版本。
我使用的是Windows 7上的R2014a版本。
MATLABDesktop.xml
的文件中,该文件位于用户的prefdir
(偏好目录)文件夹中。您可以在MATLAB中键入prefdir
并按下Enter或RETURN来查看此位置。由于您也在使用Windows,因此还可以通过此方式在MATLAB中打开文件夹:winopen(prefdir);
prefdir
文件夹。MATLABDesktop.xml
文件中删除。prefdir
文件夹中的另一个名为MATLABDesktop.xml.prev
的文件中。我正在使用Windows 7中的MATLAB R2014a,并已仔细检查了一下这些文件是否也存在于我的系统中,它们是存在的!MATLABDesktop.xml
文件,用MATLABDesktop.xml.prev
文件的副本替换它,并将其重命名为MATLABDesktop.xml
。然后重新启动MATLAB,编辑器应该会以您之前的选项卡重新打开。MATLABDesktop.xml.prev
中提取文件名。%parse XML file
xmlFiles = xmlread([prefdir filesep 'MATLABDesktop.xml.prev']);
%Retrieve the "clients"
FileNodes = xmlFiles.getElementsByTagName('Client');
%get the length of the FileNodes
nrFiles = FileNodes.getLength;
%initialize Files
Files = cell(nrFiles,1);
%initialize isFile
isFile = zeros(nrFiles,1);
%Iterate over all Elements and check if it is a file.
for iNode = 0:nrFiles-1 % Java indexing.
%Files
Files{iNode+1} = char(FileNodes.item(iNode).getAttribute('Title'));
%check if the "client" is a file:
isFile(iNode+1) = exist(Files{iNode+1},'file') == 2 && ~(strcmp(Files{iNode+1},'Workspace'));
end
%remove the other files:
MyFiles = Files(find(isFile));
%open the files in the editor:
edit(MyFiles{:});