www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SaveUNIXCommandExitStatusandOutputExample.m

    %% Save UNIX Command Exit Status and Output  
% List all users who are currently logged in, and save the command exit
% status and output. Then, view the status.   

%%  
command = 'who';
[status,cmdout] = system(command);
status 

%%
% A |status| of zero indicates that the command completed successfully.
% MATLAB(R) returns a list of users in |cmdout|.