FUNCTION REFERENCE
system
Run an operating system command.
Run an operating system command.
Syntax
status = system(command)Syntax
[status, output] = system(command)Syntax
[status, output] = system(command, '-echo')Runs command through sh -c (Linux and macOS) or cmd /C (Windows) and returns its exit status; output holds what it wrote to standard output and standard error, as text. With fewer than two outputs, or with '-echo', the output is also printed. Stop ends the command.
Example
[status, out] = system('echo hi') % status 0, out 'hi' and a newlineDifferences from MATLAB: Standard input of the command is empty; no environment-variable arguments; output is limited to 4 MiB. Not available in the browser console.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.