Cara Assosiasi M File Atau Mat File Ke Matlab

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

-to associate with .

m file
cwd=pwd; cd([matlabroot '\toolbox\matlab\winfun\private']); fileassoc('add','.m'
) ;cd(cwd);
-to associate with .mat file
cwd=pwd; cd([matlabroot '\toolbox\matlab\winfun\private']); fileassoc('add','.ma
t') ;cd(cwd);
CARANYA LG:
Final solution (thanks to Mohamed Talaat Harb, Zack, Matt H, Felix, Jesse Sipple
)
- Right click on m file, properties, opens with: [change], change the program th
at .m file starts with to notepad
- w/ windows explorer, navigate to \Program Files\MATLAB\2012b\bin (or similar f
older where matlab.exe is located)
- right click on matlab.exe and run as administrator
- in command window, type:
commandwindow; cwd=pwd; cd([matlabroot '\toolbox\matlab\winfun\private']);
fileassoc('delete',{'.m','.mat'}); fileassoc('add',{'.m','.mat'}); cd(cwd)
- close Matlab
- navigate to folder that contains any .m file
- right click .m file, properties, opens with: [change], MATLAB (R2012b) should
have appeared. Select it, click ok, click ok.
Should be all good to go!
CARA LAIN:
I did not find the complete solution to my case here, so 1st post to give my fee
dback on this subject (but I was close to the solution thanks to you, thank you
very much ;) ).
Finally, as I expected, it is not a direct matlab problem but a Windows one. I f
ound a clue to the solution here : http://support.microsoft.com/kb/258860/en
Indeed, it seems that Windows can do several associations with any extension fil
e. The "fileassoc" command remove only extensions in folder HKEY_LOCAL_MACHINE/s
oftware/classes or in HKEY_CLASSES_ROOT, but association can also be performed i
n HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
for example, and it takes the lead !
So finally, in my case, the steps I followed to be sure to perform a correct ass
ociation are :
1 - use fileassoc('delete', {'.m','.mat','.mdl','.mdlp','.fig','.p','.mlprj','.m
exw32'})
2 - delete (manually) the association still present in HKEY_CURRENT_USER\Softwar
e\Microsoft\Windows\CurrentVersion\Explorer\FileExt (start=>execute=>regedit to
edit registry, admin rights should be needed)
=> maybe association could be found in other locations, be careful to find all o
f them !
3 - use fileassoc('add', {'.m','.mat','.mdl','.mdlp','.fig','.p','.mlprj','.mexw
32'})
Step 1 and 3 are perfectly described by other people in this group, so I do not
give more details. I did not find step 2 anywhere (or I missed it) and it was th
e main issue to me.

You might also like