cannot upload the code to the board

I have been using the board couple of times before and the codes have successfully uploaded. I have initialized the arduino with matlab and thereafter when i try to upload a code in arduino ide it keeps giving the message, " problem uploading to board"

</
Arduino: 1.8.5 (Windows 10), Board: “Arduino/Genuino Uno”

Sketch uses 11484 bytes (35%) of program storage space. Maximum is 32256 bytes.
Global variables use 566 bytes (27%) of dynamic memory, leaving 1482 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can’t open device “\.\COM3”: Access is denied.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

This is most likely happening because Matlab has COM3 open so avrdude can't access it. You need to either figure out how to close the port in Matlab or close Matlab.