IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
get_computer_name.m
Go to the documentation of this file.
1 %> @file
2 %> @ingroup misc ioio parallelgroup
3 %> @brief Returns the host name
4 %>
5 %> This solution was found on MATLAB Exchance Central
6 %>
7 %> Original author: Manuel Marin
8 function name = get_computer_name();
9 
10 [ret, name] = system('hostname');
11 
12 if ret ~= 0,
13  if ispc
14  name = getenv('COMPUTERNAME');
15  else
16  name = getenv('HOSTNAME');
17  end
18 end
19 name = lower(name);
20 
21 % eliminates CRLF
22 name(name == 10) = [];
23 name(name == 13) = [];
function get_computer_name()