If the version number of Simulink Support Package for Arduino Hardware that you have installed is 20.1.0, then you might face this issue. To know the version of the installed support package, execute the following command:
matlabshared.supportpkg.getInstalled
To resolve this issue follow the instructions given below:
Execute the following command in MATLAB command prompt.
setenv('ARDUINO_STATIC_LIB_PATH',['/Users/' getenv('USER') '/Documents/MATLAB'])