- 1.0 Overview
- 3.0 Building from Source
- 4.0 Testing
- 5.0 Use in Other Projects
- 6.0 API Documentation
- 7.0 References
- 8.0 License
Slxio is an open‑source C++11 library for reading, writing, visualizing, and exporting Simulink .slx model files.
The project is designed as a lightweight alternative to MATLAB’s proprietary libraries and runtime, similar in spirit to the matio library for .mat files. Its goal is to make Simulink models accessible outside the MATLAB ecosystem, enabling manipulation and integration through modern scripting languages such as Python, Java, and others via C++ bindings.
The project was originally derived from the Java-based Simulink parser of the ConQAT Project. Find the original source code here SimulinkLibraryForJava. It has since been ported to C++ and refactored into a highly modular architecture.
Slxio does not aim to support all Simulink features, but rather focuses on the most commonly used ones. The library provides a simple and intuitive API for accessing and modifying Simulink model components such as blocks, lines, parameters, and Stateflow charts, via a mimic of the MATLAB Simulink API. This makes it easy for users familiar with MATLAB to get started.
To install the prebuilt binary of the library, refer to the Installation section and check out the latest release from the official GitHub release page,for building the library from source, see the same page for detailed instructions.
Examples and tutorials for beginners are hosted with the project and can be found on the Tutorials page, along with their source code. Many of the features are not yet implemented or tested. For a detailed list of features and their support status, see the feature section.
The project is under active development, and contributions are highly encouraged. See the Contributing guide for basics on Git, CMake, C++, and workflow, and the Development guide for quick-start instructions and advanced details.
Note
This project is still in an experimental phase. It is not yet ready for production use, and no stable release has been published.
- Read Simulink internal block‑diagram files into native C++ data structures.
- Export model hierarchies into JSON, HDF5, or Graphviz‑compatible formats.
- Edit metadata and parameters, then save changes back into
.slxfiles. This feature may be delayed because Simulink files follow the Opc Convention and the archive layout changes between versions. We currently maintain the libopc project to provide a portable, cross‑version abstraction for editing. - Perform static analysis on Simulink models and generate reports in PDF or HTML.
- Visualize Simulink models interactively. For now, only the Qt backend is supported. Other 2D graphing engines or tools are open for discussion — please feel free to start one here.
Slxio aims to support MATLAB releases from R2018a to R2025a. Currently, the primary supported versions are R2019a and R2018a. Additional versions will be progressively supported in future project releases.
Note
Some new features introduced in the graphical interface (e.g., layout, formatting, annotations) by MathWorks may not be available, as the project focuses on core model/library block diagram data.
*.mdl files are out of scope, for certain specific releases they may be partially compatible, but no support or fixes are planned for mdl file compatibility.
At present, there is no official documentation from MathWorks regarding the slx data format or XML schema rules. As a result, this project relies on reverse engineering and interpretation of actual compressed slx files.
To ensure compatibility when using slxio with unsupported Simulink versions, we recommend exporting models to one of the supported versions before reading them. This process may require a valid MATLAB license. For more information, see: Simulink Export to Version.
| Release | Status | Comment | Release Notes |
|---|---|---|---|
| R2018a | Release Notes | ||
| R2018b | Release Notes | ||
| R2019a | Release Notes | ||
| R2019b | Release Notes | ||
| R2020a | Release Notes | ||
| R2020b | Release Notes | ||
| R2021a | Release Notes | ||
| R2021b | Release Notes | ||
| R2022a | Release Notes | ||
| R2022b | Release Notes | ||
| R2023a | Release Notes | ||
| R2023b | Release Notes | ||
| R2024a | Release Notes | ||
| R2024b | Release Notes | ||
| R2025a | Release Notes | ||
| R2025b | Release Notes |
Feel free to contact the maintainer through email at mail
If you are interested in collaborating, please see the CONTRIBUTING guide or contact the maintainer via email (see section 1.2). Due to time constraints, responses and pull request reviews may be delayed. Thank you for your understanding.
The easiest way to install is to visit the Releases page and download the latest release for your platform.
Note
slxio is not yet available on vcpkg, once it is published, you will be able to install it using:
vcpkg install slxioSee Conan.
Note
slxio is not yet available on the Conan package manager, once it is published, you will be able to add it to your project using a Conan recipe.
This section describes how to build slxio, see 2.1 describes the dependencies,
Slxio has its own modular build wrapper, written on top of CMake, similar to many open‑source projects. All core dependencies are vendored with the source code in the ThirdParty directory to maximize platform compatibility and reduce reliance on external build/fetch rules. Optional dependencies may either use system‑wide installations or be fetched externally depending on configuration options, via CMake package managers or other internal helpers.
| Library | Version | Introduced In | Depends On | Notes |
|---|---|---|---|---|
| slog | Latest | v0.1.0 | ||
| json-c | Latest | v0.1.0 | ||
| zlib | 1.2.8 | v0.1.0 | ||
| libzip | 1.11.4 | v0.1.0 | zlib | |
| libxml2 | 2.14.5 | v0.1.0 | ||
| TinyXML2 | v0.1.0 | Not yet used | ||
| HDF5 | 1.14.1 | v0.3.0 | zlib | experimental |
| matio | 1.5.28 | v0.3.0 | zlib, HDF5 | experimental |
| cxxopts | 3.3.1 | v0.3.0 | experimental | |
| doctest | 1.14.0 | v0.3.0 | ||
| libuv | v0.3.0 |
Support for compressed SLX, JSON, MAT, and h5 file formats requires the zlib library. Version 1.2.8 of zlib is bundled with the code and will be built automatically if not found by CMake in the system path. Other versions are not officially supported.
Support for MATLAB MAT files, used for reading Simulink-related data structures, is provided through matio, which itself requires the HDF5 library. Additionally, for serializing SLX files into standard .h5 data files, SLXIO depends on the HDF5 library. If the library is not found, it is automatically fetched and built via CPM. However, it is recommended to use a prebuilt binary, as this significantly reduces the build and compilation time.
Building the library from source can be time‑consuming depending on your system configuration and setup. For a quicker installation, we recommend using the binary distribution for each platform
mkdir build && cd build
cmake -G "MinGW Makefiles" ..
cmake --build .
cmake --install .| Option | Description | Default | Supported Since |
|---|---|---|---|
| BUILD_SHARED_LIBS | Build as shared libraries | OFF | |
| ENABLE_PYTHON_BINDING | Enable building Python interface | ON | |
| ENABLE_TESTING | Build C++ unit tests | ON | 0.1.0 |
| ENABLE_BINDING_TEST | Build binding interface tests | ON | |
| ENABLE_NAMESPACE | Enable global namespace | TRUE | |
| ENABLE_ABI_NAMESPACE | Enable ABI namespace (requires ENABLE_NAMESPACE=ON) | ON | |
| USE_LOCAL_LIBS | Use locally installed libraries | ON | |
| ENABLE_OPENMP | Enable compiling with OpenMP support | ON | 0.1.0 |
| ENABLE_AVX | Enable AVX optimizations where available | ON | |
| ENABLE_HDF5 | Enable HDF5 support | ON | 0.1.0 |
| ENABLE_MATLAB | Enable MATLAB support | OFF | |
| ENABLE_PKGCONFIG | Generate pkg-config file | ON | |
| ENABLE_INSTALL | Enable installation after build | OFF | |
| ENABLE_SANITIZER | Enable sanitizers (ASan/UBSan/etc.) | OFF | |
| ENABLE_CLANG_TIDY | Enable static analysis with clang-tidy | OFF | |
| ENABLE_CPPCHECK | Enable static analysis with cppcheck | ON | |
| ENABLE_CLANG_FORMAT | Enable Clang-Format support mode | ON | |
| ENABLE_COVERAGE | Enable code coverage reporting (GCC/Clang) | OFF | |
| ENABLE_FUZZING | Enable fuzzing support | OFF | |
| ENABLE_DOCUMENTATION | Enable documentation generation | OFF | 0.1.0 |
| BUILD_EXAMPLES | Build example applications | OFF | 0.1.0 |
| CMAKE_INSTALL_PREFIX | Default install path | ${CMAKE_BINARY_DIR}/install |
0.1.0 |
Slxio has moved from GoogleTest to the doctest framework for lightweight and efficient testing since version 0.1.0.
Testing is enabled via the CMake option ENABLE_TESTING.
To run all unit tests after building, use:
ctest -C Debug --output-on-failureThis will execute all project unit tests by default.
Note: Code coverage is not yet supported.
If a test fails, check Testing/Temporary/LastTest.log,
test/testSubDir/${testname}/${testname}.vg.out, and other similar files.
Currently, the only supported build system is CMake. Other build systems are not planned at the moment, though they may be considered in future discussions.
Below are several ways to integrate slxio into your project:
-
- Using FetchContent (built-in CMake module)
The simplest way is to use CMake’s built-in FetchContent to add slxio as an external dependency.
This will automatically download, configure, and build the library alongside your application.
include(FetchContent)
FetchContent_Declare(
slxio
GIT_REPOSITORY https://github.com/wissem01chiha/slxio.git
GIT_TAG master
)
FetchContent_MakeAvailable(slxio)
add_executable(app main.cpp)
target_link_libraries(app PRIVATE SLXIO::SLXIO)-
- Using CPM.cmake (CMake Package Manager)
If you prefer a package manager approach, you can use CPM.cmake to fetch and integrate slxio
CPMAddPackage(
NAME slxio
GITHUB_REPOSITORY wissem01chiha/slxio
VERSION 0.1.0
)
add_executable(app main.cpp)
target_link_libraries(app PRIVATE SLXIO::SLXIO)-
- Using ExternalProject
For more control, you can use ExternalProject to build slxio separately and then link it:
include(ExternalProject)
ExternalProject_Add(
slxio
GIT_REPOSITORY https://github.com/wissem01chiha/slxio.git
GIT_TAG master
UPDATE_DISCONNECTED 1
PREFIX ${CMAKE_BINARY_DIR}/slxio
INSTALL_COMMAND ""
)
add_executable(app main.cpp)
add_dependencies(app slxio)
target_link_libraries(app PRIVATE SLXIO::SLXIO)-
- Using find_package
Once slxio provides proper CMake configuration files, you’ll be able to integrate it like any other modern CMake package:
find_package(slxio CONFIG REQUIRED)
add_executable(app main.cpp)
target_link_libraries(app PRIVATE SLXIO::SLXIO)Since version 0.1.0, Slxio has used Sphinx for documentation.
However, for detailed implementation documentation, Slxio includes integrated support for Doxygen, which can be enabled via the ENABLE_DOCUMENTATION cmake option.
Shrestha, S. L., Chowdhury, S. A., & Csallner, C. (2022). SLNET: A Redistributable Corpus of 3rd-party Simulink Models (v2.0). Zenodo. https://doi.org/10.5281/zenodo.5259648
All material is provided under an Apache License unless otherwise specified.
see the LICENSE file for more details