how to read arduino serial data in matlab

3 views (last 30 days)
Please i want to know how o read arduino serial monitor data in matlab. In my arduino serial monitor there are z y x coordinates. I want to send this data to matlab and save as a array. Please can anybody tell me what is the arduino coding for that and matlab coding. Please help me

Accepted Answer

Walter Roberson
Walter Roberson on 8 Oct 2016
On the Arduino side, use Serial.print or Serial.println . If you use Serial.print remember to send some character (blank, comma) between coordiantes as Serial.print does not add delimiters by itself.
On the MATLAB side, use arduino() to get an arduino object. Use fgets() or fgetl() or fread() to pull in text and then parse the text in various ways, or use fscanf() or textscan() to combine reading and parsing.

More Answers (0)

Categories

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

Tags

Products

Community Treasure Hunt

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

Start Hunting!