Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

24 rindas
776B

  1. function [ ipaddress ] = getLocalIP()
  2. %GETLOCALIP returns the ipaddress of the current windows machine
  3. if ispc
  4. % Code to run on Windows plaform
  5. [status,result]=system('ipconfig');
  6. if ~(status == 0)
  7. error('Failed to find local IP address');
  8. end
  9. ipaddress = regexp(result,'(?<=\n IPv4 Address[ \.]*: )([0-9]{1,3}\.?){4}','match');
  10. elseif ismac
  11. % Code to run on Mac platform
  12. [status,result]=system('ifconfig');
  13. if ~(status == 0)
  14. error('Failed to find local IP address');
  15. end
  16. ipaddress = regexp(result,'(?<=\n inet )([0-9]{1,3}\.?){4}','match');
  17. elseif isunix
  18. % Code to run on Unix platform
  19. else
  20. error('Platform not supported');
  21. end
  22. end