How do I open an m-file from the command line in the current instance of the Matlab editor?

If I run the following command at the dos prompt:
"C:\Program Files\MATLAB\R2011a\bin\matlab.exe" -r "edit('C:\Documents\MATLAB\test.m')"
a new instance of Matlab is opened with test.m open in the editor. Is there anyway to modify the command so that the m file is opened in the current instance of Matlab?
For context, I'm using TortoiseHg for source control in Windows. I'd like to be able to jump from a file listed in a revision history to viewing that file in Matlab. In THG, this is done by specifying a 'visual editor' as a command line specification.

回答 (2 件)

Songyun Wang
Songyun Wang 2017 年 10 月 17 日
編集済み: Songyun Wang 2017 年 10 月 17 日

1 投票

Just use the function "edit". Try "help edit"
Fangjun Jiang
Fangjun Jiang 2011 年 9 月 12 日

0 投票

If you just want to use the editor, you can run "meditor test.m" at the command line.
meditor.exe is in folder matlabroot\bin\win32

3 件のコメント

Darik
Darik 2011 年 9 月 13 日
I can't find meditor where you said it'd be -- it looks like Mathworks no longer includes it with Matlab?
I did manage to figure out that I can run "start test.m" at the command line to do what I want - this appears to be equivalent to double-clicking on a file in explorer and doesn't start a new matlab process unless necessary.
Fangjun Jiang
Fangjun Jiang 2011 年 9 月 13 日
What version of MATLAB are you using? What happened if you run meditor at the dos prompt?
Walter Roberson
Walter Roberson 2011 年 9 月 13 日
Newer versions do not include a stand alone editor.
I recall that there have been some previous Questions having to do with re-using the current instance of MATLAB under MS Windows. I did not pay attention to the details as I do not use MS Windows, but if you were to search MATLAB Answers for the word "instance" you would probably find the discussions.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange で Environment and Settings についてさらに検索

製品

タグ

質問済み:

2011 年 9 月 12 日

編集済み:

2017 年 10 月 17 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by