Rebooting Matlab

I saw a very effective code sniplet to reboot matlab(unfortunately, there is no reboot command in matlab ) and i added it as a shortcut to workspace header. Here is the code:

% Reboots matlab. Currently only works if only one instance of matlab is running.
[x, out] = system(‘tasklist /v /fo csv | findstr /i “matlab.exe”‘);
if length(strfind(out, 10)) > 1
disp(‘More than one instance of Matlab are running, don”t know which to kill.’);
out = out(length(‘”MATLAB.exe”,”‘)+1:end);
nd = strfind(out, ‘”‘);
mypid = out(1:nd(1)-1);
% Start a new instance of Matlab on a separate process in the same
% directory.
system([‘start matlab.exe -sd ‘ pwd()]);
system([‘taskkill /f /pid ‘ mypid])