File Exchange

image thumbnail

MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware

Acquire sensor data and control outputs on LEGO MINDSTORMS EV3


Updated 20 Feb 2020

MATLAB® Support Package for LEGO® MINDSTORMS® EV3 Hardware enables you to use MATLAB to communicate with the LEGO MINDSTORMS EV3 over a USB cable, wireless network, or Bluetooth®. MATLAB functions are provided to control the motors and interface with other sensors and actuators on the robot.

This support package is functional for R2014b and beyond.

Comments and Ratings (29)

@Matevz Lavtar: From the error log that you have posted, the usage of the command is incorrect. To use a irSensor, kindly use the following syntax

>> myev3 = legoev3('USB');
>> mySensor = irSensor(myev3, <inport>);

where <inport> is the input port to which you have connected the IR sensor. (1 to 4)


I cannot read data from infrared sensor. Could someone help me please with this error:

>> myev3 = legoev3('USB');
>> myirsensor = irSensor(myev3)
Error using fusion.internal.remotesensors.ScanningMount (line 381)
Invalid property/value pair arguments.

Error in fusion.internal.remotesensors.ScanningSensor (line 173)

Error in irSensor (line 453)
obj@fusion.internal.remotesensors.ScanningSensor(varargin{:}); - Show complete stack trace

Pradeep KS

Pointers to troubleshoot connection issues with MATLAB and Simulink LEGO MINDSTORMS EV3 support packages.

fix yo thing


Piece of straight up garbage.

It does not work. Downloading of the "third party packages" does not work.
What is the problem with that?

How do i connect to EV3 using blue

Omar Mohd

I don't know what people are complaining about - this worked very easily for me in Matlab 2018A, Win10. Great!

Tong Wu

也许明年学弟们就能看到我了 /滑稽.... (18Spring超哥的最优控制)

Yining Qi

piece of garbage

@Suhail:Which open source code are you referring to?

how to access the open source code after installing the support package

Hey guys.
Disable your antivirus if you're having trouble installing third party packages.



Does not connect consistently.

I cannot install this support package. I had it installed on my previous computer running MatLab 2016 with no issues, but now I can't install it with 2017.

chris B

I doesn't work. The brick is connected with the computer. The low level matlab instruction works, but not this package.
deviceInfo = instrhwinfo('Bluetooth','EV3CB')

deviceInfo =

HardwareInfo with properties:

RemoteName: 'EV3CB'
RemoteID: 'btspp://0016534C257F'
ObjectConstructorName: {'Bluetooth('EV3CB', 1);'}
Channels: {'1'}

It doesn't work. Can't install the support package :(

min aung

MATLAB Release Compatibility
Created with R2014b
Compatible with R2014b to R2019b
Platform Compatibility
Windows macOS Linux