Thanks to the MathWorks support team, I reported this problem and they found a working solution (at least in my case):
1. Shutdown MATLAB
2. Go to the folder inside the Arduino Mega support package (by default this should be in
Note : This is the location which the user installed the support package for Arduino.
3. Make a backup of the existing file "toolsInfoDataArduinoMega2560.p"
4. Overwrite the file "toolsInfoDataArduinoMega2560.p" with the attached P-file (unzip first).
5. Restart MATLAB and execute "rehash toolboxcache"
6. Try the code generation and deployment for the boards in question and verify functionality