Arduino Tutorial 07: Matlab

Welcome to the seventh Arduino Tutorial from our Arduino Tutorial Series. In this tutorial we will learn how to connect Arduino to Matlab and how are they communicatng using the Serial Port. Also we will make an example where we will use Matlab to control the Arduino Board.

This is a Step by Step Video Tutorial which is easy to be followed. Also, below the video you can find the parts needed for this tutorial and the Source Codes of the Examples in the video.

Components needed for this Arduino Tutorial

Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.

Circuit schematic of the examples


 Matlab Code


clear a; a = arduino('COM4'); a.pinMode(8, 'OUTPUT'); a.pinMode(12, 'INPUT'); tic while (toc<10) b=a.digitalRead(12); if ( b==true) a.digitalWrite(8,1); else a.digitalWrite(8,0); end end
Code language: Arduino (arduino)

3 thoughts on “Arduino Tutorial 07: Matlab”

  1. ı also getting this warning when i type install_arduino.

    Warning: There is at least another arduino.m file in the path, the installation will go on but it is strongly suggested to delete
    any other version before using this one

  2. hi,
    I m triying to do same thing but i m getting an error says;

    Warning: Unsuccessful read: A timeout occurred before the Terminator was reached..
    Error in testttt (line 2)
    a = arduino(‘COM4’);

    my Uno connected to the COM4 for sure. But i am getting same error every time. I also tried with pro mini, ıt was on COM3, but result is the same. I couldn’t succeed to connect arduino via Matlab.

    Do you have any advise? Can you please help me out?


    • There’s probably so problem with the connection, but I could point out anything specific. Try again to do exactly the same as described in the video. Plus the version of your Matlab and the plugin could be the problem, as they have released new Arduino plugins for the the Matlab 2015.


Leave a Comment