How to open mat file into runing matlab.exe without opening a new one?

조회 수: 7 (최근 30일)
Hello ,
I have a m-file. Whenever i click on it matlab opens, which is fine.
The problem is, if I have matlab open already it open another one.
I just want to open m-file in the existing matlab (if matlab.exe is already running) not sure how to fix this?

채택된 답변

Abhishek Pandey
Abhishek Pandey 2015년 7월 17일
Hi Hesham,
In order to open a MAT-file using an existing session of MATLAB, follow the steps below:
If you’re running Windows XP or Vista, the following commands in MATLAB will reconfigure the associations of MATLAB-file for Windows for versions R2013a or earlier:
cd([matlabroot '\toolbox\matlab\winfun\private']);
fileassoc('add', {'.m','.mat','.mdl','.slx','.fig','.p','.mlprj'})
For versions R2013b or later, the path to fileassoc is instead:
cd([matlabroot '\mcr\toolbox\matlab\winfun\private']);
Note that, MATLAB must run with administrator privileges in order to perform the registry changes. So you will need to start MATLAB as Administrator, run the code above, and then quit MATLAB. Then try to open a MATLAB file via Windows explorer once to verify that MATLAB starts and then try to open another MATLAB file and verify that a second instance of MATLAB does not get started.
If this does not work, then check to make sure that you are not always running MATLAB with administrator privileges enabled. If so, then Windows itself (with User Account Control - UAC) is the actual cause of the problem. Windows (with UAC) will not allow the explorer to send DDE (Dynamic Data Exchange) messages to a process running with administrator privileges enabled.
If you’re running Windows 7 or later, follow the instructions in this doc .
I hope this helps!
- Abhishek

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by