MATLAB Function Reference    
unix

Execute a UNIX command and return the result

Syntax

Description

unix command calls upon the UNIX operating system to execute the given command.

status = unix('command') returns completion status to the status variable.

[status, result] = unix('command') returns the standard output to the result variable, in addition to completion status, .

[status,result] = unix('command','-echo') forces the output to the Command Window, even though it is also being assigned into a variable.

Examples

The following example lists all users that are currently logged in. It returns a zero (success) in s and a string containing the list of users in w.

The next example returns a nonzero value in s to indicate failure and returns an error message in w because why is not a UNIX command.

When including the -echo flag, MATLAB displays the results of the command in the Command Window as it executes as well as assigning the results to the return variable, w.

See Also

Special Characters


 unique unwrap