unix('command')
[status,output] = unix('command')
unix('command')
executes a UNIX operating system command. The statement returns the resulting status as an integer and the standard output in a string variable.
[s,w] = unix('who')
returns s = 0
and, in w
, a MATLAB string containing a list of users currently logged in.
If the UNIX command fails, MATLAB returns a nonzero status value. For example,s =
0
w =
gulley console Apr 13 09:32
joe ttyp0 Apr 13 09:02
sully ttyp2 Apr 13 09:37
gulley ttyp2 Apr 13 09:37
gulley ttyp3 Apr 13 09:34
marianne ttyp4 Apr 13 10:43
[s,w] = unix('why')
why: Command not found.
s =
256
w =
[]
!
(c) Copyright 1994 by The MathWorks, Inc.