如何关联m文件和Matlab编辑器

由于各种各样的原因,m文件与Matlab默认编辑器之间的关联可能丧失,这种情况下着急是没用的.大笑

重装matlab是浪费时间的大哭 关联的方法是这样的

Associate m-file with MATLAB Editor

If you can’t open a M-file by double clicking on the file icon, you should read this. I’ve been trying so hard to find the way to re-associate M-file with MATLAB Editor, but not MATLAB it self. In this article, I’ll show how to re-associate M-file with MATLAB Editor in Windows XP and Windows 7.

When you loose the associating between M-file and MATLAB Editor, it’s easy to associate m-file to MATLAB in Windows. But if you do this, every time you double click a m-file will open a new MATLAB process. It’s a little annoying, right?

So this is the way to associate M-file to MATLAB Editor but not MATLAB itself.

1. in Windows 7

  1. Open the MATLAB program(需要以管理员身份运行哦亲大笑否则下面修改注册表的命令是会被拒绝的哦);
  2. Copy and paste the following commands group in MATLAB command line and hit enter to run it:
  3. commandwindow; 
    cwd=pwd; 
    cd([matlabroot '\toolbox\matlab\winfun\private']); 
    fileassoc('add','.m');
    cd(cwd); 
    disp('Changed Windows file association. M-files are now associated with MATLAB. Congratulations!')


  4. Locate a .m file (M-file) in a folder in your computer;
  5. Right click this .m file, navigate to Open with, then Choose a default program(C);
  6. A window like below would open now, click to choose MATLAB, then click OKto save the settiing (sorry for the confusing Chinese in the graph):

    Choose MATLAB Editor to open M-file

    If you choose MATLAB Starter Application in the next, every time you double click a m-file will open a new MATLAB process.

This magic command group is mentioned here.

2. in Windows XP

  1. Open a folder, navigate to Tools and Folder Options in the menu bar;
  2. In the popup windows, click File Types, locate and choose the file type of M-file below the Registered File Types area, then click Restore below it.
  3. If this doesn’t work, please continue reading the following section.

3. Notes

If you had changed the Editor/Debugger Preferences in MATLAB Preferrences page ( at File – Preferences – Editor/debugger ), maybe you should change it back to make your new setting take effect.

MATLAB Editor preference

整出这个英文版的说明,是因为我发现很多英语用户也在为这个问题烦恼。中文用户请看中文版©

本文发表于水景一页。永久链接:<http://cnzhx.net/blog/associate-m-file-with-matlab-editor/>。转载请保留此信息及相应链接。


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值