Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

21 Zeilen
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