File Exchange

image thumbnail

MATLAB Support Package for Raspberry Pi Hardware

Acquire sensor and image data from your Raspberry Pi.


Updated 12 May 2021

Editor's Note: Popular File 2018

MATLAB® Support Package for Raspberry Pi™ Hardware enables you to interactively communicate with a Raspberry Pi board, even remotely from a computer running MATLAB

You can acquire data from sensors and imaging devices connected to the Raspberry Pi and process them in MATLAB.

Feature Highlights:

● Communicate with other hardware through the GPIO, PWM, Servo, Serial, I2C, and SPI interface
● Capture images and record videos using Raspberry Pi addon Camera boards
● Capture images using USB Web camera connected to Raspberry Pi
● Control Sense Hat shield connected to Raspberry Pi board
● Use MATLAB Runtime environment to create and execute compiled MATLAB applications on systems without an installed version of MATLAB
● Deploy a MATLAB function as a standalone executable with Run on Target Hardware workflow on Raspberry Pi boards
● Develop and Deploy standalone embedded applications to run algorithms including Deep Learning with Run on Target Hardware workflow on Raspberry Pi boards
● A dedicated MATLAB App, - Raspberry Pi Resource Monitor, - to manage deployed applications and other hardware peripherals connected to Raspberry Pi

To know more about the supported Raspberry Pi boards and other features, visit -

This support package is functional for R2014a and beyond.

For a step by step tutorial, watch Getting Started with MATLAB Support Package for Raspberry Pi -

For installation issues with this support package, please contact MathWorks Technical Support -

● For MATLAB R2017a and earlier versions, this support package is currently unable to download third-party software. For details and workaround, see this Bug Report
● MATLAB R2017b and later versions are unaffected.

Comments and Ratings (162)


Hi Mircea,
We are working on supporting Raspberry Compute Module boards in future releases.
Here is the list of Raspberry Pi boards that are supported in MATLAB.

MATLAB Hardware Team

I have a question regarding the compatibility list of the hardware. I am currently trying to procure hardware for a project and I am wondering if this plug in will be compatible with the Raspberry Compute Modules (3/4).
Thank you.

Hi Ren,
Could you please share more details on the issue you are facing? If possible, could please share it in the MATLAB Answers Community forum. MATLAB Answers forum is frequently monitored by wide user base and even the MathWorks staff keep an eye on the unanswered questions. If you did not receive any satisfactory suggestions/solution from the forum then please contact our Technical Support for further assistance.

MATLAB Hardware Team

Ren Xiang Lee

Hi, I'm having error download this package. Please let me know how can it be solve.

Hi Asaipillai,
Yes, Raspberry Pi 4B board is supported in R2021a. For more info please refer following link,

MATLAB Hardware Team

Asaipillai Prathap

can we connect raspberry pi 4 B with Matlab 2021

Hi FlyWing,
For Simulink blocks you can choose Raspberry Pi 4B as the name of the Pi. And for the MATLAB command you can execute "$ cat /proc/cpuinfo | grep Revision" on your pi terminal and see the last 4 digits of the revision name is present in "getBoardName()" function from RaspiBase.m? You can do ">> edit raspi.internal.RaspiBase.m" in MATLAB and this should open the file. If its not present then you can contact our Technical Support for further assistance.

MATLAB Hardware Team


The raspberry pi 4b is recognized as 'Raspberry pi model B+' after I use command 'mypi=raspi'. Is this a protiential problem? For simulink blocks that required to choose the board name, should I choose model B+ or pi 4 model B?

Prasanth Sunkara

Hi Hasrul,
It is possible that one of the latest windows OS software updates might have removed the VCRuntime dll. Could you please try the steps suggested in the below link to install the required dll and let us know how it worked?


Hi Hasrul,

Could you please escalate this to MathWorks Technical Support?

MATLAB Hardware Team


I got this error 'The code execution cannot proceed becausw VCRUNTIME140_1.dll was not found' when try to write mathworks_raspbian_R21.1.0 firmware to the sd card. How to solve this problem?



Chris Hada

Hi Prasanth,

thanks for your fast reply. You can look for my service requests and "community asks" on my profile. I have also contact your support. There is even one running more then a year, without solution or success.
- 1. The call to ert_make_rtw_hook, during the entry hook generated the following error:
Error using uset_param>unifysetparam (line 231) (Case Number: 04778030)
Unsupported parameter specified: ParameterPooling
- 2. Cant install Raspberry Pi Support Packages on MATLAB R2021a (
- 3. CAN Receive Issues when using more then one Receive Block (Case Number: 04229368: Issue CANReceive block)

One of them is nearly 1 year old.

Im working on my master thesis now and have to validate if we can use Matlab/Simulink for developging Functions for thermodynamics Regulationsystems. And after all im giving up working with mathworks.

Prasanth Sunkara

Hi Chris,

I am sorry to hear that you could not get this to work. Could you please share more details on the issue you are facing? If possible, could please share it in the MATLAB Answers Community forum. MATLAB Answers forum is frequently monitored by wide user base and even the MathWorks staff keep an eye on the unanswered questions. If you did not receive any satisfactory suggestions/solution from the forum, please escalate this to MathWorks Technical Support.



Chris Hada

doenst work and no support.

Cant find any solutions in the internet.

R2021a feature highlights
* Connect to sensors to read both on-demand and real-time data, visit -
* New functionalities added to Raspberry Pi Resource Monitor app, visit -
The Raspberry Pi Resource Monitor App from the MATLAB Support Package for Raspberry Pi Hardware has been improved to:
* Display peripherals used in a MATLAB or Simulink® application deployed on the Raspberry Pi hardware
* Enable or disable peripherals
* Check for missing libraries and packages
* Display all processes currently running on the Raspberry Pi hardware

Micky Elias

Prasanth Sunkara

Hi William,

In order to understand the issue better, could you please share the error messages? Also, please share the MATLAB version and the MATLAB code/Simulink model you have tried that led to the errors. For detailed discussion on this, please consider posting this as a question with the above requested information in MATLAB Answers forum.



Hi need some guidence and appriciate the previouse support, I need to use "C = semanticseg(img, net);" function but Function 'semanticseg' not supported for code generation. Any solution that anyone can suggest? Thanks


Hi Reeno Thank you for that advice about the fopen and fwrite I'll try them, actually I need to get the current time of the Raspberry pi, my application involves saving images with the timstamp including both date and time of the image captured.

Reeno Joseph

@Nipuna: If your usecase is to identify elapsed time, please use tic & toc directly - they are codegen supported.
For saving some data as a text file you can use fopen & fwrite. Please refer to this link for more details:
Saving an image(as jpg or png) to the SD card requires encoding functionality and the codegen capability of "imwrite" is not ready yet. As a workaround, you can use fopen & fwrite and save the image data as a binary file. Later on, you can export this data to MATLAB and process it.


Hi all, I tried and practised all the examples given including object detection still I could not find a way to save the data in Raspberry Pi SD card after a function is completed. Why this packege does not support basic Matlab commands like get the current time, save image in the Raspberry Pi SD, Save a text file.

Reeno Joseph

@Jonah : Yes, you can swap the SD card and the Raspberry Pi will boot with the Operating System available on the SD card.

Jonah Pearl

Hi all -- beginner question here -- after I boot the Raspberry Pi from this SD card with the custom MATLAB build, I can reverse that just by swapping back out the SD card, right? Ie, if the RPi currently has SD card A, and I put the custom MATLAB build on SD card B, boot from B, then switch back to A, it should be like nothing changed about A's firmware, right? (Maybe there will be some extra files hanging around but I'm just concerned with making sure the RPi can be used for more than one software purpose!)

Prasanth Sunkara

Hi Luis, Looks like Simulink was not able to connect(SSH) to the Pi's IP addr ( Most likely, it could be due to the PC running MATLAB and the Pi are not in the same network or the Pi's IP addr is incorrect. Could you please execute the below commands on MATLAB CMD line to ensure we have a connection to the Pi with the right IP addr:
1) >> !ping <ip_addr_of_your_pi> % This will check if Pi is in the same network
2) >> r=raspberrypi("<ip_addr>","username","password") % this would create a SSH connection to the pi.
If point 2 works, there would not be any issue deploying Simulink models to Raspberry Pi. If you still face any issue, please contact MathWorks Technical Support


Luis Soto

Thanks Prasanth. I have done and i can connect vía ssh in my terminal but when i try to connect via Simulink, matlab show me this error:

Connection to SSH server at closed. Clear the hardware communication object and re-create it to establish connection.
Component:Simulink | Category:Model error


Prasanth Sunkara

Hi Luis, if you already have an raspbian image, you can follow OS customization process.
Please see: This briefly touches upon the process to do OS customization

Luis Soto

Hi, I have the raspberrypi 4 8G and I can't install your image. I have installed the raspbian image.
What can I do in the raspberrypi to communicate with Matlab?. Thanks

Prasanth Sunkara

Checkout the latest features of R2020b release. (

Major features include monitoring various resources and deployed processes from an app.

Also check out Simulink support package which lets you deployed standalone programs and Monitor & Tune them.
For more info see:

Prasanth Sunkara

@Mucahit, for now please use the R2020b image. We are working on updating the support package to support 8 GB variant as well.

Alan Segal

Mucahit Aktürk

raspberry pi 4 b 8 gb doesnt support mathworks raspian version R20.1.0 , fix it please!

Prasanth Sunkara

@Eric, some quick suggestions are to run MATLAB as administrator, check that the lock switch on the SD card is in un-locked position.
If you are still any issues, please contact MathWorks Technical Support.


@Max, did anything ever work for you? I'm getting that same "Error writing firmware to the memory card: dd: ... Operation not permitted" on a Mac. Thanks.

Justin Lajoie

Hello. I am trying to install the matlab image on the SD card. It then will not connect to matlab after inslalled in the SD card. I have tried reformatting the SD card and that did not help. I am working with a pi zero if that helps. Also, all software is being run as an administrator. Is there anything I am doing wrong?

hazem alsaleh

Should download any software on SD card before work on matlab?

Prasanth Sunkara

@Max, Please refer to the below MATLAB answers post for some suggestions.

Max Knödel

Does somebody have an solution to the following problem?

"Error writing firmware to the memory card: dd:
Operation not permitted"

I'm using a Mac and already tried to delete the "img_writer_log.txt" file

Mohith Prabhu

Prasanth Sunkara

Check out the latest MATLAB R2020a release.
Major highlights: Raspberry Pi 4B is fully supported and Deep learning algorithms can be deployed onto the Raspberry Pi(check out the examples)


Sarah Chadwick

Hi Everyone, when I download the raspberry pi hardware package and connect the raspberry pi via ethernet, the block isn't available in the simulink library browser. Anybody have any idea how I can make it appear?

Prajwal R Patil

hey guys !! for those ppl getting the error code " unable to locate package matlab-rpi"
please change your raspberian os to streach by downloading it. only raspberian streach and Jessie support matalb

HK Physicist

Does this module support Raspberry Pi 3A+?

Lokesha ms

we want hough transform prog

Mei Sing Wang

Hi I tried to install Matlab in my pi 3 B+ but it states "Unable to locate package matlab-rpi", is it still not applicable to Raspbian Buster?

hi please help me can i install raspberry pi 3b+ on matlab 2019b+ it goes to 99 percent of install then sey faild to install im really confusing

Ahsan Tanveer

Hi, Is it compatible with Raspberry Pi 4 B?

@Cesar Hernandez Dimensions of arrays being concatenated are not consistent
in 2018b choose wireless network then u wont get error

Thomas Ployhar

Prasanth Sunkara

xiao yang

My matlab version is (R2018b), but this package can not be installed for a matlab 9.5 is needed.

Anand Shirke

I have a Raspberry Pi 4 Model B and Matlab 2019a
Can this support package help me connect both of them?

David Ward

Hi, I have a Raspberry Pi 3B+. Creating the firmware image did not work, so I have used the customize existing operating system to set it up. I have been able to connect via SSH, and it tried to update. It failed on installing the three libraries, but I have manually installed these now. It still says it has failed on wiringpi, but i can see this is installed to latest version from the shell. I then tried to follow the getting started guide, but it fails when creating the raspi object.
I enter "rpi = raspi();" and it fails with the message "The user name or password for raspberrypi-7wxTO7laKv is incorrect." I know the username and password, but have no idea how I change it inside Matlab itself.

The Linux version on the Pi is 4.19.75-v7+ #1270

Thank you.

Kevin Gleason

Cesar Hernandez

Hi all,
I tried to to configure the Support Package for Raspberry Pi Hardware with the Mathworks Raspbian image.
However, after Matlab has written the image to the SD card, I received a Hardware Setup Error with the message "Dimensions of arrays being concatenated are not consistent" when clicking Next to finish the setup.
I tried reformatting the SD card many times with SD Card Formatter but the error keeps persisting. Even running Matlab in Administrator mode does not work.
Any help would be very welcome.

mehmet enes avcu

I cant download the third party package. can you help me

Cesar Hernandez

@Mohith Prabhu My problem is with the 2017B version.

Mohith Prabhu

@Andreas Gasteiger and @Daniel Palumbo : Could you please re-try the installation. The glitch has been resolved.

@GOKU CHIDO : Which release of MATLAB are you having this issue with?

Andreas Gasteiger

i cant download the third party software, i have also the version R2017b...

Cesar Hernandez

it wont download the third party package. Someone help me?

Daniel Palumbo

it wont download the third party package. I have the version R2017b


@zhiqi wang Unzip the "", use "...\mathworks_raspbian_R18.2.3.img" as a path in Setup, validate will success, or just install the image by yourself.

Reeno Joseph

The latest Raspbian Buster is not completely tested with the support package.
If there is any incompatibilities or build error while using Raspbian Buster, please use the "MathWorks customized Raspbian image" (based on Raspbian Stretch) which can be downloaded from the hardware setup screen.

Kamran Joyo

HIgh Tech Man

Mohith Prabhu

@juli marquez: The MATLAB and Simulink Support package for Raspberry Pi support Model B+ of Raspberry Pi. When using Simulink, under the Hardware Implementation section of the model configuration parameters, select the hardware as 'Raspberry Pi'. This selection is common to all revisions of the Raspberry Pi board.
When using the MATLAB support package, no selection of the Raspberry Pi model is required when attempting to connect using the raspi command

Kai Chuen Tan

Why there is no mpu9250 in the raspi.internal package contents for the Raspberry Pi Zero W?

juli marquez

my problem is that i can´t conect the raspberry because there isn´t the b+ version

Mystic Hightower

I got this error: "Dimensions of arrays being concatenated are not consistent" after writing to SD card and clicking 'Next'.

Fatma Alsadani

i can't find raspberry pi 3 model b+ why?

rahul ahire

i got an error while installing raspberry pi support package for 2018b. after writing sd card when i click next it shows error " Dimensions of arrays being concatenated are not consistent". please help me

Someone help me!! i got this....

Error using matlabshared.internal.ssh2client
Error connecting to SSH server at

Error in raspberrypi (line 183)
obj.Ssh = matlabshared.internal.ssh2client(hostname, ...

Mohith Prabhu

@zhiqi wang The 18.2.3 release on github has been fixed. Kindly download it and continue with the setup.

zhiqi wang

@Mohith Prabhu I have discovered different versions of mathworks_raspbian img files on your Github page, but the mathworks_raspbian_R18.2.3 seems to be R19.1.0 after unzipping, which probably does not support Matlab R2018. I want to use mathworks_raspbian_R18.2.3, so do I have to use Matlab R2019?

zhiqi wang

MATLAB Support Package for Raspberry Pi Hardware and Simulink Support Package for Raspberry Pi Hardware are installed. But firmware (downloaded from Github given in Hardware Setup) zipped as mathworks_raspbian_R18.2.3, seems to be R19.1.0. So as I validate this zip in Hardware Setup, this Setup breaks automatically. Could anyone give me some advice to install this .img fiile to my Rasppi.

Mohith Prabhu

@Jan Hrabina The installation of Support packages in MATLAB with version R2017b or later are unaffected and do not require any patch to be installed.

michael pak

Cannot install anything,
Simply get to the screen where it ask to insert and SD, i do and it cant find the SD.

What do i do?

Jan Hrabina

It was neccessary for me to use the "Bug report" solution also in case I have R2018b (copy the file from *.zip to Matlab folder).


Bill Chou

Fragrant Sun



Starting from a Raspberry Pi 3 Model B running clean Raspbian Stretch image (June 2018)
- install matlab-rpi (sudo apt-get install matlab-rpi)
- enable desired busses (sudo raspi-conig)
- enable SSH (sudo raspi-config)

Running Matlab 2017a on Windows 10 x64 machine, ran into 4 problems and found 4 fixes below.

PROBLEM #1: Tools fail to build on raspi
Error using raspi.internal.updateServer (line 90)
Error executing command "make -C /opt/MATLAB/server_v17.1.1 -f Makefile". Details:

STDERR: In file included from /usr/include/string.h:630:0,
from devices.c:4:
devices.c:56:11: error: expected identifier or ‘(’ before ‘__extension__’
char *strndup(const char *s, size_t n)
FIX #1:
strndup already exists in standard c library, so comment out "#ifndef HAVE_STRNDUP ... #endif" section in 'C:\ProgramData\MATLAB\SupportPackages\R2017a\toolbox\realtime\targets\raspi\server\devices.c'

PROBLEM #2: Fails LED configuration while getting available peripherals

Error in raspi/getLEDConfiguration (line 723)
trigger = ret{1};

Error in raspi/getAvailablePeripherals (line 980)
obj.LED.(id).Trigger = getLEDConfiguration(obj,name);

Error in raspi (line 246)

getLEDConfiguration() fails to identify the current trigger setting because the internal TCP request mechanism prematurely clips the trigger list after 250 chars.

FIX #2:
Modify EXT_LED_GetTrigger() in 'C:\ProgramData\MATLAB\SupportPackages\R2017a\toolbox\realtime\targets\raspi\server\LED.c' to read the full trigger list. I modified line 88 to read 512 chars instead of the original 250. Note you'll need to force a rebuild of the MATLAB I/O server on the Pi for the change to apply (use updateServer() from the raspi class).

PROBLEM #3: Board incorrectly identified as "Raspberry Pi Model B+"
FIX #3: The partial output of /proc/cpuinfo on my Raspberry Pi Model 3 board is:
Hardware: BCM2835
Revision: a02082

Modify getBoardName(obj) in raspi.m:
From: if isequal(hwId{1},'2709')
To: if isequal(hwId{1},'2709') || isequal(hwId{1},'2835')

PROBLEM #4: Unable to query I2C bus speed.
rpi = raspi(...) is able to detect 'i2c-1' but still gives the following warning: "Warning cannot query I2C bus speed..."

FIX #4: enableI2C(rpi) will enable the I2C bus at the default baud rate of 100,000.

Heiko Neuberger

During installation of this package on Matlab 2017a, I'm getting the following message during download of third party packages:
Download Error
There was a problem downloading the third-party software. To resolve this issue, contact Technical Support

Could anybody provide help on this issue?

Marek Cherubin

I experienced quite funny situation with new RPi 3 B+ and R2018a.
I decided to use "customize the existing OS"
unfortunatelly I couldn't pass the SSH test:
I was sure, that SSH worked fine and after some attempts (still failed)
I came back to the R2017b and here everything went smoothly!
According to my expectations I can use now RPI Support Package in both 2017b as well as R2018b!

Astonishingly when I tried to check again SSH test connection in Hardware Setup using R2018b - I get all fine.
The conclusion is
Fortunately for me that I did not remove the "outdated" R2017 after installing R2018a!

David Flory

The instructions make setting up this package more difficult than it should be.

I was able to get the RPi 3 B+ as well as a Pi Zero W connected to Matlab over a wireless connection using the following method:
1. Don't bother with the setup wizard or with downloading the special Matlab release of Raspbian. Just download and install the latest version from

2. Enable SSH and a network connection. Write down the IP. The easiest way to do this is to physically log onto the Pi with a monitor and keyboard. Otherwise you will need to edit config files on the microSD. Instruction in how to do this is detailed elsewhere.

3. After installing this plugin, simply create a Matlab RPi object, i.e. mypi=raspi('yourPi'sIP','login name', 'password') The plugin will automatically install all necessary support files!

Venkatesh Chilapur

Hi Fernando,

Please check the link below, this info is also available in the comments a little below.

Jun W

1. Lack of consumer complaints is the reason why Matlab Raspberry Pi Support Package has no basic commands after four years of release and has not been updated for over four years.
2. Small user group leads to less activities/contributions in Matlab central, while all the Matlab Central staff not required to answer questions, the community is only going to shrink.
3. Taking complaints regarding product’s own problems as a disrespectful/personal issue is the reason why Matlab is only developing from a developer’s perspective, not a consumer’s perspective.
4. Deleting people's reviews under the support package only means the team knows the reviews are true.

Muhammad Kaleem

Fernando Vega Lara

What do i do if i want to connect a raspberry pi zero w?

Mohammad Mirian

Works well, nice

emad shokrallah

my version is matlab R2016a and cannot install Raspberry pi 3 package ,,"Fatal Alert" any help please ,my gradution project stop on this point

Simon Orlob

There is a solution for setting up the raspberry pi also with the latest MATLAB versions.
Starting from a clean raspbian-stretch-lite (flashing SDcard like described by
- install matlab-rpi (sudo apt-get install matlab-rpi)
- enable desired busses (sudo raspi-conig)
- enable SSH (sudo raspi-config)
Now you can connect with MATLAB (in my case: raspberrypi('','user','password') )

You can also connect the rpi to MATLAB Online (see:
//sensors are working fine, haven't tested rpi3B+ yet

Elhassan Mohamed

please add support for Raspberry pi 3B+
If anyone manage to use the newest Raspberry pi please help

Benedikt Böhling

By running the 'targetupdater' on my pi 3b+, by
- Setup hardware with Mathworks Raspian image R18.1.0): "No Network connection possible"
- customizing existing Hardware(stretch-lite works well) : "Establishing SSH connection with hardware failed"
in the last case, stretch- lite works well and no communication error, but not in mathlab... :-((
What's my mistake?

Does anyone know if this software supports raspberry pi 3b+ ?

Adriano Koss

I have trouble with the most basic... How I do function my raspberry pi with matlab???.... I folled the instructions step to step and nothing...

Reeno Joseph

@Yuanqi Wang, All the MathWorks customized Raspbian img for different releases are hosted in GitHub. For 18a you can download from this url:

Yuanqi Wang

The img download link always broke at around 700Mb of the total 900Mb, no way to resume. Already tried several time before giving up. How come there isn't even a public download link? Very disappointed.

Amir Baniamerian

I have been trying to connect MATLAB 2017b to pi3.
After Installing all support packages and follow all steps several times, still connection fails.
1. MATLAB set the pi IP as, while the actual IP is
2. I can ping pi from cmd.
3. MATLAB can ping the corrected IP (manually). SSH connection however fails.
Any suggestion is very appreciate is.

Pradeep KS

MATLAB R2018a is out!!

Support added for Raspberry Pi Zero W board
You can now use the MATLAB® Support Package for Raspberry Pi™ Hardware with the Raspberry Pi™ Zero W board.

MATLAB Support Package for Raspberry Pi Hardware enables you to communicate with Raspberry Pi Zero W using Wi-Fi® or a micro-USB cable connection. For more information on how to communicate with Raspberry Pi Zero W, see

Reeno Joseph

@Feng Fan: From 18a onward, during hardware setup, you will see "Download MathWorks Raspbian image" screen. Click on the 'Download' link in the screen to get This will download the Raspbian image from the github page :

You can also go to the above github page and download manually.

Feng Fan

The mathworks_raspbian_R18.1.0 can't be downloaded.

Pradeep KS

If you are facing Download Error while installing the MATLAB and Simulink Raspberry Pi Support package in R2018a release, follow below mentioned steps:

1. Go to folder location "C:\Users\<user id>\Downloads\MathWorks\SupportPackages" on your machine.
2. Delete all the old support package files and folders. Make sure the folder is empty.
3. Try installing Support package from Add-On Manager.

Khalid Albraikan

Julien Blomme


Spencer Chen

The raspi.m is in serious need for an update.
Following on Mark Goodnough's comment, I encounter similar problems using Pi3 with R2017a and the latest support package.
Browsing through the raspi.m script, I can see that most of the code is looking for the bcm2708 drivers, but my Pi3 is using bcm2835 drivers. I can see that some parts of raspi.m has been updated to check the bcm2835 drivers but not the i2c section.
Another problem is the LED configuration. getLEDConfiguration() is failing because it cannot identify the current trigger setting. The problem appears to be that the internal TCP request mechanism chops off the trigger list after 250 chars, and the actual trigger list is longer than that, and my default trigger for led0 is [mmc0] which lies beyond the 250 chars limit.


hao jun

Marek Cherubin

Execution of
rpi = raspi('ip-address','username','password')
generates errors - exactly the same as described in previous post from 7 Oct 2017 by Mark Goodnough (PROBLEM #1: fails builing tools on raspi )

Error using raspi.internal.updateServer (line 90)
Error executing command "make -C /opt/MATLAB/server_v17.2.0 -f Makefile".

Alberto Barbieri

Alessandro La Conca

I couldn't connect to the pi in any way (LAN, Wireless, etc.), the pi couldn't be detecte, the test connection failed and the PWR LED wasn't solid red.
Despite all this I managed to connect to the pi using rpi = raspi('ip-address','username','password'), I found the IP Addess from my phone using the app network scanner and I used the default username and the password to connect pi and raspberry.
Hope this message helps someone in my condition.

wajeeh mirza

Help required! Third party software download gets stuck at 1% progress.

Gaurav Sharma

Mark Goodnough

Updated to Matlab 2017b on Windows 7 x64 machine
Reinstalled Raspberry Pi Support Package V using install to existing raspian system approach.
Ran into 3 problems and found 3 fixes:

PROBLEM #1: fails builing tools on raspi
obj = raspi('192.168.*.*', 'pi','********')
### Updating Raspberry Pi I/O server...
### Connecting to board...
### Connected to
### Creating server folder...
### Transferring source files...
### Building MATLAB I/O server...
Error using raspi.internal.updateServer (line 90)
Error executing command "make -C /opt/MATLAB/server_v17.2.0 -f Makefile". Details:

STDERR: In file included from /usr/include/string.h:630:0,
from devices.c:4:
devices.c:56:11: error: expected identifier or ‘(’ before ‘__extension__’
char *strndup(const char *s, size_t n)
FIX #1: Commented out "#ifndef HAVE_STRNDUP ... #endif" section in devices.h in the '/opt/MATLAB/server_v17.2.0' and did a on raspberry make in that directory.
strndup exists anyways. Didn't diagnose the real error.
PROBLEM #2: Board was mis-recognized as "Raspberry Pi Model B+"
FIX #2: The partial output of /proc/cpuinfo on my Raspberry Pi Model 3 board is:
Hardware : BCM2835
Revision : a22082

In the getBoardName(obj) function (in raspi.m), made these changes:
From: if isequal(hwId{1},'2709')
To: if isequal(hwId{1},'2709') || isequal(hwId{1},'2835')

The board is now properly recognized.
PROBLEM #3: rpi = raspi(...) now gives: "Warning cannot query I2C bus speed..." even though it
detects 'i2c-1'.
FIX #3: enableI2C(rpi) seems to enable it permanantly with 10000 bus speed.
Haven't checked with real I2C device and this issue may be related to problem #1 not
being run in the normal fashion.


It seems that the 3P.instrset is installed the 2nd time I launch installation.

I will see if it works in the next days.




Windows 10 Home install problem/
Cannot find the file containing firmware information:
This file has either been deleted or moved to a different location. Re-install the support package to get the required files.

I have no 3P.instrset in R2017a

Where is the problem ?


Please make a support package for the Raspberry Pi Zero and Zero W. Why this isn't already done is mind boggling...


I'm kinda new to matlab and raspberry but I had no problems setting this up! Everything works as espected/described.

Reeno Joseph

@DomenicoPerillo Please refer to our github page :
All the steps required to customize Raspbian Jessie to be compatible with MATLAB and Simulink are documented there.

Domenico Perillo

I'm new on using Raspberry Pi and this guide helped me a lot but I hoped there was a way to install MATLAB® Support Package for Raspberry Pi™ directly from stock firmware Raspian with jessie using sudo apt-get command, to avoid replacing Raspian with jessie stock Firmware and losing all apps.


Encountered an error writing the SD Card which I solved copying 3 DLLs
19.01.2017 14:31 5.634.720 mfc120u.dll
19.01.2017 13:26 660.128 msvcp120.dll
19.01.2017 14:26 963.232 msvcr120.dll
to: ProgramData\MATLAB\SupportPackages\R2017a\toolbox\realtime\targets\raspi\bin\win64
which already has sdwriter.exe in it.
Just search on your local PC for the DLLs.
R2017a + Windows 10


@ClementYap I got the same issue and i tried to change the installation directories and that didn't work either.. Can someone please help

Clement Yap

I ran into the problem while attempting to setup . The problem stated,

"Cannot find the file containing firmware information:

This file has either been deleted or moved to a different location. Re-install the support package to get the required files.". I tried re-installing and it is still not solved. And how do I connect pi-raspberry (Model 1B) to PC? Use USB? Which usb port?



How do i start mathematica from this image ? "mathematica" command does nothing -_-

Stephen Lewis

Following on from the post below, I reverted back to R2016a and the generation of a new SD card image worked fine as before. So something has happened in R2017a - this probably isn't where I need to report a bug though, where should I do that? Thanks.

Stephen Lewis

This worked very well until I tried to install it again today after upgrading to R2017a. Install works fine, but when I run the setup to generate the SD card image I get an error message saying that the downloaded image cannot be accessed because it's being used by another process. I've rebooted and uninstalled / re-installed the support package but still get the same error message.

Ali Alipour

Hi , i cant download this package send to mail for me. thanks a lot

Ali Alipour

aruna jadhav


I just tried to install it on Ubuntu and Matlab 2016a, but it says it cannot be installed because it requires the host platform to be either Win64 or Mac64.

Installing with the support package installer doesn't work either.

Does somebody know how to solve this problem?

Omar Alaryani

The support package and the instructions on the Mathworks website are great!

However, I would like to use this for multiple Raspberry Pi devices simultaneously, in one M-file. Is this possible?

Saurabh Ghatnekar

can I install this on Ubuntu 16.04 Matlab 2016b?

Zaid Pirwani

so, I have a working Raspberry Pi in our lab and I just want to connect it to MATLAB to get data and then process it - I DO NOT want to install new image on my Pi, is there any way.???

or is there any way for me to easily have a connection between the MATLAB on Windows PC and my Pi - both are in the same network and I have admin access to both and know the IPs

Med Aymane Ahajjam

Hello, Please can you tell me if this supports raspberry pi zero?

Murat Belge

@Ashley Stewart: You do not have to disable the MATLAB server running on RPI to use "raspistill". Just make sure that you don't have any cameraboard objects in the MATLAB workspace. The MATLAB server does not grab the camera unless a cameraboard object is created. Hence, you can use raspistill even when MATLAB server is running.

Ashley Stewart

How can I disable the MATLAB server on the RPi? I want to use the camera via Raspistill, but it's in use by the server on startup!

ahmed shamakh

Support Package installer :
MATLAB Support Pachage for Raspberry pi Hardware cannot be intalled on this system
it requires :

Base Product :MATLAB
Host Platforms : Win32,Win64,Mac64

WHY NO LINUX ??????????

Ilya Glants

is there support for raspberry pi zero?



while installing package getting an error displaying "network connection down or check proxy setting" how to solve this error??



I cannot get a wireless internet connection while running this image. Is anybody else getting the same problem?


UP ! Howto get this package without extranet connection through locked firewall ?


Howto get this package without extranet connection through locked firewall ?

Murat Belge

@mchaaban: Simulink just needs the IP address of the board. Connect a monitor and keyboard to your Raspberry Pi and find out the IP address. Then try connecting to your board using the your board's IP address:

>> r = raspberrypi('<IP address>')


Hi, I am using the Matlab r2013b with raspberry pi 2 b; and I not able to connect to simulink with the support package. what should i do?

Thank you.

Murat Belge

@Miguel: Assuming that you really connected some I2C sensor to the i2c-1 bus, make sure that you either:

1. Not use device tree: You can turn it off using raspi-config utility
2. Use device tree: enable I2C driver (


Hi, I am using the Matlab r2014a and raspberry pi b, b + y 2 b; and I have the disadvantage that reads addresses on the i2c port and nothing is connected, waiting for your comments I leave.
Thank you.

pi@raspberrypi-b-plus ~ $ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --


Murat Belge

We are in the process of updating the R2014a and R2014b support packages for Raspberry Pi 2 board. I would recommend you wait for the update.

If you want to add the required MATLAB server to your existing Raspbian image, run the following on the MATLAB command line after installing the MATLAB Support Package for Raspberry Pi hardware:

>> raspi.internal.updateServer('<IP Address>, '<username>', '<password>')

This function adds the required MATLAB server to your Raspberry Pi hardware. Substitute correct values for IP address, username and password.

You will need to restart the server every time your Raspberry Pi reboots.


Hello dear @Murat Belge, I'm using Matlab R2014a with raspberry pi 2, use your method of manually install the following:

$ sudo apt-get update
$ sudo apt-get install ibsdl1.2-dev alsa-utils espeak x11vnc guvcview i2c-tools libi2c-dev ssmtp ntpdate git-core v4l-utils cmake
$ cp /etc/ssh/sshd_config /home/pi/
$ echo -e "\\n\\n# Turn off reverse DNS lookup\\nUseDNS no\\n" >> /home/pi/
$ sudo mv /home/pi/ /etc/ssh/sshd_config

At this point reboot your board:
$ sudo shutdown -r now

The results were positive with Raspberry pi2 and Simulink, but now Querio know how I can do to have the tools of Matlab Support Hardware where serial, i2c, spi port is controlled.
Thank you very much.
Greetings from Peru.

Murat Belge

R2015a Support Package add built-in support for Raspberry Pi 2 Model B boards.

Murat Belge

@Joerg: Yes you need a server running on Raspberry Pi that talks to MATLAB. The firmware image that comes with the MATLAB Support Package for Raspberry Pi comes with this server baked into the Raspbian Linux image. There are other Linux customizations needed for the MATLAB support package to work with an existing Linux images. It is not just the server.

There is no way to re-configure an existing Raspberry Pi to work with the MATLAB support package in R2014b release. I'll recommend creating a new SD card containing the Raspbian Linux image that comes with the support package.

We are working on supporting this particular use case for a future release. However, we will only be supporting the Raspbian distribution.


Is it possible to configure existing Raspberry image to work with Matlab Support Package? Looks like there is some TCP server on port 18725 needed.

Murat Belge

Version 14.1.2 of the MATLAB Support Package for Raspberry Pi Hardware has been released. The updated support package contains full support for the new Raspberry Pi Model B+ board.


MATLAB Release Compatibility
Created with R2014a
Compatible with R2014a to R2021a
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!