用matlab改写了一个m-file,可以修复matlab的文件关联,m文件可以直接用editor打开,而不是新开一个窗口。
% fix_matlab_filetype.m
% fix_matlab_filetype.m
% This function helps fix filetype association error of matlab files
% By Shengzhen Feng at minidick@163.com
cwd=pwd;
cd([matlabroot '\toolbox\matlab\winfun\private']);
fileassoc('add',{'.m','.mat','.fig','.p','.mdl',['.' mexext]});
filename = 'fix_matlab_filetype.reg';
fid = fopen(filename,'w');
fprintf(fid, 'Windows Registry Editor Version 5.00\n');
fprintf(fid, ['[-HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\',...
'CurrentVersion\\Explorer\\FileExts\\.m]\n']);
fclose(fid);
dos(['regedit.exe /s ' filename]);
cd(cwd);
disp(['Changed Windows file associations. FIG, M, MAT, MDL, MEX, ',...
'and P files are now associated with MATLAB.']);