I want to shutdown my computer in matlab scripts when the program has ran to end. Is there any commands about this?
2 Answers
This should work:
system('shutdown -s');
You can also try the following function as posted in Matlab Central.
function shutdown(varargin)
if nargin
if isnumeric(varargin{1})
if varargin{1} == -1
evalc('!shutdown -a');
return
end
t = ceil(varargin{1});
else
t = 60;
end
else
t = 60;
end
eval(['!shutdown -s -f -t ' num2str(t)])
USAGE:
shutdown= turn off the computer in 60 secondsshutdown(numsec)= turn off the computer in numsec secondsshutdown(-1)= abort the shutdown; don't turn off the computernumsec= optional number of seconds to pause after system shutdown window is displayed (defualt is 60 seconds). If numsec is -1, then the command aborts a shutdown countdown currently in progress.