M-files opening in new instances of MATLAB during each click: Mac computer

21 views (last 30 days)
Is there a fix for file associations in a mac (m-files don't open up in MATLAB but open up in a new instance of MATLAB instead)?

Answers (1)

Moin
Moin on 30 Jun 2022
I understand, that when you are trying to open a m-file, a new instance of MATLAB is being created instead of opening in the same MATLAB instance.
There might be 2 reasons for this.
1. Your current MATLAB instance is created as root privileged (administrator). So when you try to open the m-file normally, as it doesn’t have the administrative privileges, a new instance has been created.
To work around this issue, you can enable writing to the pathdef.m file. The pathdef.m file is located in the directory:
MATLABROOT\toolbox\local
where MATLABROOT is the result of executing the following in the MATLAB zsh:
matlabroot
To enable writing to pathdef.m:
  1. Open the directory with pathdef.m in Finder, right-click on the file and click “Get Info” button.
  2. Click the “Sharing and permissions” button to modify permissions.
  3. Select the user or group that should be allowed to write to pathdef.m, i.e., Users.
  4. Check the "Write" check box and click "Apply"
If you have previously set MATLAB to be run as an administrator, change it to run it as an ordinary user. You will be now able to save path to the pathdef.m file and each time you click on the MATLAB file, if MATLAB is already open, MATLAB file will be opened in the Editor of the open MATLAB instance.
2. This issue may also arise if you uninstall an earlier release of MATLAB after installing a newer release. The newer release uses a different method to register file associations.
These associations are deleted from the registry when an older release is uninstalled. In this situation, please uninstall the new release and reinstall it.

Categories

Find more on Desktop in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!