MATLAB Answers

Matlab R2014a updates my Arduino Server Code, without asking

13 views (last 30 days)
Jonas on 2 Oct 2014
Answered: Jonas on 16 Oct 2014
I have a 64bit Win8.1 computer with Matlab R2014a and microcontroller Arduino Mega2560 attached. Both run without any problems. But when I try to call the Arduino via Matlab by
>> a = arduino ('COM2')
it starts updating the server code of the arduino. Usually information about the board appears. Instead:
Updating server code on Arduino Mega2560 (COM2). Please wait.
The expected information appears afterwards. This is a problem, because my program does not like this new server code. When running it the following Error appears:
No appropriate method, property, or field pinMode for class arduino.
Error in program>pushbutton1_Callback (line 88)
ledPin2 = 2; a.pinMode(ledPin2,'output');
Error in gui_mainfcn (line 95)
Error in program (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)program('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Uploading the original server code to the Arduino does not help, it will update it again.
This program runs on older Matlab versions and on R2014a on Win7 without any difficulties . Always with the not-updated server code. Why is it updating the server code on my computer? I have no explanation for this.
-->Why is Matlab doing this to me?


Geoff Hayes
Geoff Hayes on 2 Oct 2014
Jonas - try putting a breakpoint at line 88, re-run your code and type the following in the Command Window
to return the class type of a and the methods of a. Given the error message, the class type should still be recognized as arduino but that pinMode is not a method. Perhaps we can get some idea of what methods it does have, and what may have happened to the object.
Jonas on 7 Oct 2014
Indeed, nearly all relevant methods were missing. Thanks for the hint. Solution is quite simple:
Read the readme-file of the ArduinoIO package carefully and find out that Matlab needs to be started in Admin mode when installing the support package...
Now it works fine and I'm happy!
Geoff Hayes
Geoff Hayes on 7 Oct 2014
Jonas - glad that you got it working. If the solution was to start MATLAB in admin mode when installing the support package, then go ahead and write that as an Answer. That way, users who have this same problem can jump straight to it.

Sign in to comment.

Accepted Answer

Jonas on 16 Oct 2014
The solution is to start MATLAB in admin mode when installing the support package.
(Found in readme-file)


Sign in to comment.

More Answers (0)

Sign in to answer this question.