Skip to content

nexus_deployed_stdio

miscellaneous · scripts/miscellaneous/nexus_deployed_stdio.m

: nexus_deployed_stdio ()
: nexus_deployed_stdio (name, value, …)
: argout = nexus_deployed_stdio (…)

Run a deployed-application entry point in stdio (non-interactive) mode.

MATLAB Compiler standalone apps suppress the interactive prompt and pass command-line tokens to the entry-point function as character vectors. Nexus matches that when NEXUS_DEPLOYED is 1 and standard input is not a terminal (or when "Force" is true for tests).

Internally the tokens are held as a cell array of character vectors ({'42', 'hello'} for ./myapp 42 "hello"), then expanded so the entry point is invoked as separate inputs — the MATLAB default, which is equivalent to main ('42', 'hello') (not numeric 42).

Name-value options:

"Entry"

Entry-point name (char) or function handle. Default: NEXUS_DEPLOYED_ENTRY, else "main".

"Argv"

Cell array of character vectors to pass. Default: user tokens from __argv__ with the program name and Nexus/MATLAB CLI switches removed.

"Force"

Logical; when true, skip the deployed / non-interactive gates (tests).

"Exit"

Logical; when true (default outside "Force"), call exit after the entry point returns. Forced test calls default "Exit" to false.

"Numeric"

Logical; when true, convert each token with str2double like mcc -n / TreatInputsAsNumeric (non-numeric tokens become NaN).

Packaged launchers should set NEXUS_DEPLOYED=1 and NEXUS_DEPLOYED_ENTRY and invoke this function (or rely on the startup autorun when both are set and stdin is not a tty).