How to open mat file into runing matlab.exe without opening a new one?
6 views (last 30 days)
Show older comments
Hesham Ismail
on 10 Jul 2015
Commented: Hesham Ismail
on 20 Jul 2015
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?
0 Comments
Accepted Answer
Abhishek Pandey
on 17 Jul 2015
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.
I hope this helps!
- Abhishek
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!