matlab-subprocess-stdin

Version 1.1.0.0 (10.4 KB) by scivision
Pipe stdin with Java to run external processes from Matlab
4 Downloads
Updated 2 Oct 2023

This is part of https://github.com/geospace-code/matlab-stdlib

stdlib.sys.subprocess_run()

Matlab stdin pipe

matlab View matlab-subprocess-stdin on File Exchange

Uses Java ProcessBuilder (built into Matlab) to run external processes from Matlab >= R2021a with stdin pipe. Matlab system() does not allow for stdin pipes, but these examples do allow stdin pipes. Using stdin / stdout instead of temporary scratch files can be faster and more robust.

Usage

Simply copy subprocess_run.m into your Matlab project.

cmake -B build
cmake --build build

ctest --test-dir build -V

Notes

The executable must exist as a file. For example, on Windows the inbuilt shell commands that aren't files like "dir" don't work. This is also true in Python subprocess module.

Windows

On Windows, using system() with MPIexec can cause intermittent segfaults that don't occur from Terminal. Using our Java ProcessBuilder-based subprocess_run() can mitigate this issue.

Cite As

scivision (2024). matlab-subprocess-stdin (https://github.com/scivision/matlab-subprocess-stdin/releases/tag/v1.1.0), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2023b
Compatible with R2021a and later releases
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

See release notes for this release on GitHub: https://github.com/scivision/matlab-subprocess-stdin/releases/tag/v1.1.0

1.0.0

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.