Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time

MATLAB Interface to Apache Arrow

Status

This is a very early stage MATLAB interface to the Apache Arrow C++ libraries.

The current code only supports reading/writing numeric types from/to Feather v1 files.

Prerequisites

To build the MATLAB Interface to Apache Arrow from source, the following software must be installed on the target machine:

  1. MATLAB
  2. CMake
  3. C++ compiler which supports C++11 (e.g. gcc on Linux, Xcode on macOS, or Visual Studio on Windows)
  4. Git

Setup

To set up a local working copy of the source code, start by cloning the apache/arrow GitHub repository using Git:

$ git clone https://github.com/apache/arrow.git

After cloning, change the working directory to the matlab subdirectory:

$ cd arrow/matlab

Build

To build the MATLAB interface, use CMake:

$ cmake -S . -B build 
$ cmake --build build --config Release

Install

To install the MATLAB interface to the default software installation location for the target machine (e.g. /usr/local on Linux or C:\Program Files on Windows), pass the --target install flag to CMake.

$ cmake --build build --config Release --target install

As part of the install step, the installation directory is added to the MATLAB Search Path.

Note: This step may fail if the current user is lacking necessary filesystem permissions. If the install step fails, the installation directory can be manually added to the MATLAB Search Path using the addpath command.

Test

There are two kinds of tests for the MATLAB Interface: MATLAB and C++.

MATLAB

To run the MATLAB tests, start MATLAB in the arrow/matlab directory and call the runtests command on the test directory:

>> runtests test;

C++

To enable the C++ tests, set the MATLAB_BUILD_TESTS flag to ON at build time:

$ cmake -S . -B build -D MATLAB_BUILD_TESTS=ON
$ cmake --build build --config Release

After building with the MATLAB_BUILD_TESTS flag enabled, the C++ tests can be run using CTest:

$ ctest --test-dir build

Usage

Included below are some example code snippets that illustrate how to use the MATLAB interface.

Write a MATLAB table to a Feather v1 file

>> t = array2table(rand(10, 10));
>> filename = 'table.feather';
>> featherwrite(filename,t);

Read a Feather v1 file into a MATLAB table

>> filename = 'table.feather';
>> t = featherread(filename);