Function 'subsindex' is not defined for values of class 'serial'.

1 view (last 30 days)
I'm working on getting a serial connection between arduino and Matlab. The error reads:
Function 'subsindex' is not defined for values of class 'serial';
Error in lights_controlled (line 36)
set(arduinoCom, 'DataBits', 8);
The segment of code reads:
global arduinoCom now bb f go flag_saving connected quitgui collecting ...
deletedfile enable_results reset C sensor_avg_upright saveduration ...
h_timerinput h_startbutton h_timerbutton flag_stop flag_timed...
flag_start starttoggle Upper_time h_resultsbutton;
arduinoCom = serial('COM5');
arduinoCom.BaudRate=9600;
%arduinoCom.ReadAsyncMode = 'continuous';
set(arduinoCom, 'terminator', 'LF');
set(arduinoCom, 'DataBits', 8);
set(arduinoCom, 'StopBits', 1);
set(arduinoCom, 'Parity', 'none');
set(arduinoCom, 'Timeout', 60);
Do you have any suggestions for fixing this? The code was working and we hadn't made any changes but now it is not.
Best, Perri

Answers (1)

Steven Lord
Steven Lord on 10 Dec 2015
You've defined a variable named set in the workspace and MATLAB interprets your call as an attempt to index into that variable using the serial object. Delete the variable.

Categories

Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!