How can I run matlab connected to arduino more than once?
54 views (last 30 days)
hamzah alamoodi on 20 Dec 2015
I have a problem with connecting my arduino uno to matlab.. It actually runs perfectly for the first time but when I run it again it says this (Failed to open serial port COM4 to communicate with Arduino board Uno. Make sure there is no other MATLAB arduino object for this board. For troubleshooting, see Arduino Hardware Troubleshooting.
.. I'm using this command to connect: a = arduino('com4','uno') ..
If anyone can help here I would appreciate it ...
More Answers (2)
Sadi Mohammad Rifat on 18 Jun 2017
All you have to write a command "clear all" on the first line of your code . That's it.
Sumit Banerjee on 10 May 2016
You have to delete the object which you have created. For example, if you have this object arduino_board = arduino(port, board, 'Libraries', 'Servo'); then you have to delete this object in the end of the code, i.e. clear arduino_board; all the objects which you have created like this should be cleared.