No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

21 líneas
674B

  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. [startIndex,endIndex] = regexp(result,'(?<=\n IPv4 Address[ \.]*: )([0-9]{1,3}\.?){4}');
  10. if isempty(startIndex)
  11. error('Failed to find local IP address');
  12. end
  13. for i = 1:length(startIndex)
  14. ipaddress{i} = result(startIndex(i):endIndex(i));
  15. end
  16. else
  17. error('Function only available on Windows');
  18. end
  19. end