Problem: After installing a new version of MATLAB, .m files either
1. Do not open with the correct version of MATLAB, or
2. Opens up new instances of MATLAB instead of opening up scripts in the script window

Solution: The problem is caused by registry errors. Patrik Forssén submitted a helpful file on file exchange that solves this problem (by removing outdated registry keys and adding relevant registry keys). Download the file here.

After downloading the file, run MATLAB as an admin and run the command
Then follow the instructions provided in the associateFiles.m

As of writing, this script is the best method to fix MATLAB file association errors.
It’s been confirmed working for MATLAB 2016a on Win7 and Win10.