The MATLAB Support Package for Raspberry Pi Hardware enables you to communicate with Raspberry Pi hardware remotely from a computer running MATLAB. The support package includes a MATLAB command line interface for accessing Raspberry Pi hardware’s I/O peripherals and communication interfaces. Using this command line interface, you can collect data from sensors connected to Raspberry Pi hardware and actuate devices attached to Raspberry Pi hardware.
In this example you learn how to create a raspi object to connect to Raspberry Pi hardware from within MATLAB. You examine the properties and methods of this object to learn about the status of basic peripherals such as digital I/O pins (also known as GPIO), SPI, I2C, and Serial. Using this object, you execute shell commands on your Raspberry Pi hardware and manipulate files on the Raspberry Pi hardware.
Fonte e mais detalhes aqui