matlab怎么没有编辑器,在不打开编辑器窗口的情况下开始一个新的MATLAB会话
這是因?yàn)?#xff0c;當(dāng)MATLAB打開(kāi)時(shí),它會(huì)跟蹤加載到編輯器中的文件以及每個(gè)文件的顯示參數(shù)。這些信息存儲(chǔ)在以下位置。
fullfile(prefdir, 'MATLABDesktop.xml')
沒(méi)有為你當(dāng)前在活躍MATLAB編輯器中打開(kāi)每個(gè)文件的條目。
當(dāng)您在重新啟動(dòng)時(shí)選擇不記住文件的首選項(xiàng)時(shí),會(huì)導(dǎo)致應(yīng)用程序退出時(shí)從該文件中刪除所有這些條目。
當(dāng)你有多個(gè)同時(shí)運(yùn)行的MATLAB實(shí)例(同一版本)時(shí),它們都依賴于同一個(gè)文件。所以當(dāng)你用一個(gè)實(shí)例打開(kāi)一個(gè)文件時(shí),然后啟動(dòng)一個(gè)新實(shí)例,新實(shí)例加載該文件并從中填充編輯器狀態(tài)。
至于修復(fù)這種行為,我認(rèn)為這可能是困難的。您可以也許編輯您的startup.m文件以從MATLABDesktop.xml文件中刪除所有這些條目。即使如此,我不確定這會(huì)如何影響其他正在運(yùn)行的實(shí)例的穩(wěn)定性。
腳本執(zhí)行此清潔
如果你想有一個(gè)腳本這是能夠做到這一點(diǎn),同時(shí)保留存在的配置文件中的所有其他設(shè)置,下面應(yīng)該工作。
filename = fullfile(prefdir, 'MATLABDesktop.xml');
xml = xmlread(filename);
% Find ALL entries in the file and determine "Class" attribute
clients = xml.getElementsByTagName('Client');
clients = arrayfun(@(x)clients.item(x-1), 1:clients.getLength, 'uni', 0);
classes = cellfun(@(x)char(x.getAttribute('Class')), clients, 'uni', 0);
% Find all EditorViewClient entries
func = @(x)isempty(regexp(x, '\.EditorViewClient$', 'once'));
toremove = ~cellfun(func, classes);
clients = clients(toremove);
% Remove all client entries that need to be removed
for k = 1:numel(clients)
parent = clients{k}.getParentNode();
parent.removeChild(clients{k});
end
% Write the remaining data back to the file
xmlwrite(filename, xml);
總結(jié)
以上是生活随笔為你收集整理的matlab怎么没有编辑器,在不打开编辑器窗口的情况下开始一个新的MATLAB会话的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 小森生活铁锭怎么合成?
- 下一篇: rn php,rn怎样在PHP的正则表