I've finally fixed this! I noticed that whenever I started up a command pompt, the following appeared at the top of the window:
Microsoft Windows [Version 10.0.18363.1379]
(c) 2019 Microsoft Corporation. All rights reserved.
The system cannot find the path specified.
After searching for what could be causing the "The system cannot find the path specified." message I came across the advice to clear the following registry values:
- HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
- HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
For me, the first value was populated with a conda_hook.bat file that didn't exist. After clearing the value, Matlab is able to find my compiler.