不知道怎么弄的,无法直接双击打开m文件了(双击后只是启动了matlab,没有打开文件),只能在matlab里打开

请高人指点一下吧
2024-12-23 12:44:55
推荐回答(5个)
回答1:

注意最新版的matlab,用右击.m文件打开然后查找文件关联到meditor.exe,你是找不到matlab安装程序下的编辑器程序的,而只能找到matlab.exe之类的无效关联。所以不如索性用help里面自带的办法:

打开matlab,然后打开help窗口,然后打开help目录找到第一个条目Matlab-》User's Guide->Desktop Tools and Development Environment ->Start up and Shutdown->Starting and Quitting the MATLAB Program:然后查看右边窗口的内容部分,点击Starting the MATLAB Program on Windows Platforms链接,窗口跳到下面点击Associating Files with MATLAB on Windows Platforms链接,然后窗口往下拉找到如下内容:
==========================================================================
Utilities to Set Up File Associations on Windows Platforms. If you are viewing this topic in the MATLAB Help browser, you can run one of the utilities provided here to create associations in the Windows environment for common file types used by MATLAB. This requires you to have permission to write to the HKEY_CLASSES_ROOT registry key, which typically requires power user or administrator privileges.

*

Run utility to associate files with .fig extension with MATLAB
*

Run utility to associate files with .m extension with MATLAB
*

Run utility to associate files with .mat extension with MATLAB
*

Run utility to associate files with .mdl extension with MATLAB
*

Run utility to associate MATLAB with MEX-files
*

Run utility to associate MATLAB with P-files
*

Run utility to associate MATLAB with all of these file types: FIG, M, MAT, MDL, MEX, and P

The file type icon in the Windows Explorer tool might not reflect the change immediately.
=====================================================
直接点击上面这个链接 Run utility to associate files with .m extension with MATLAB就ok了。然后回到windows下随便找个.m文件直接双击,整个世界就亮了!

回答2:

打不开的原因是m文件的默认打开程序是Matlab starter application,
而不是matlab(R2011a)。
那么怎么将m文件的默认程序改成matlab(R2011a)呢?
方法是:
简单地重新装一遍程序,
在“tipical”和“custom”一步中选择“custom”,
当到达选择安装各个模块时,
只勾选一个(任意的),安装...,
之后会出现文件关联那一页,全选上,
完成安装和激活,即可!

【附录】
也可以在command窗口输入如下代码:

cwd=pwd;

cd([matlabroot '\toolbox\matlab\winfun\private']);

fileassoc('add',{'.m','.mat','.fig','.p','.mdl',['.' mexext]}); %重点

cd(cwd);

disp('现在可以双击m文件打开了吧,试一试,记得告诉我')

回答3:

关联一下么!
右键打开方式!然后选择那个要打开的程序!下面还有个小选项始终用这个程序打开!
WIN7的话要打开方式然后再选择默认程序!再在列表里找到程序打开就可以了!

回答4:

下载并按照指导运行这个链接里的文件就可以了,亲测有效

associateFiles.m下载地址

回答5:

我一直是matlab里面打开的,反正要开,没啥区别