Matlab code on Raspberry Pi using Octave

Matlab offers support for embedded systems including:

The danger of this prototyping method is that you become very reliant on the Mathworks somewhat opaque toolchain. This has sunk prototyping efforts I’ve seen in the past when they got to a corner case that Mathworks didn’t anticipate, forcing them to onboard me to recode in another language (Python) that could run directly on the embedded computer standalone. This issue may be avoidable in certain use cases while still using Matlab script directly on the embedded system in standalone or connected mode using GNU Octave.

For example, we have achieved 30+ fps batch processing on video motion streams on the Raspberry Pi Zero this way.

Octave on Pi

Raspbian Buster 10 comes with Octave 4.4. We suggest installing Octave with

apt install --no-install-recommends octave

to save download/disk space. If you do find a need for an additional library, install as needed, particularly on Pi Zero.

We suggest also installing Octave on your laptop, so that you can verify your Matlab script works correctly on the Pi. If you’re using an advanced Matlab toolbox, Octave might not yet have that functionality, so verify that early on. In a substantial subset of cases, it will be necessary to transition from Matlab to another language like Python. We are experts in this regard.