CToon
v0.9.0 GitHub

MATLAB Binding

The CToon MATLAB binding provides a MEX-based interface to the CToon C library, allowing MATLAB users to encode and decode TOON-format data natively.

Overview

The binding exposes four public functions:

Function

Description

ctoon.encode

Encode a MATLAB value to a TOON string

ctoon.decode

Decode a TOON string to a MATLAB value

ctoon.read

Read a .toon file into a MATLAB value

ctoon.write

Write a MATLAB value to a .toon file

Quick start

matlab
% Install once
cd src/bindings/matlab
ctoon_install

% Encode and decode
s = ctoon.encode(struct('name', 'Alice', 'age', uint64(30)));
v = ctoon.decode(s);

% File I/O
ctoon.write(v, 'config.toon');
v = ctoon.read('config.toon');

Requirements

  • MATLAB R2014b or newer

  • A C compiler configured for MEX (mex -setup C)

  • MATLAB R2022b or newer for buildtool support