소스 검색

added windows for localIP

master
Wouter Horlings 8 년 전
부모
커밋
bc3a8c61fa
2개의 변경된 파일20개의 추가작업 그리고 15개의 파일을 삭제
  1. +0
    -15
      Equipment/getLocalIP.m
  2. +20
    -0
      OOequipment/subfiles/getLocalIP.m

+ 0
- 15
Equipment/getLocalIP.m 파일 보기

@@ -1,15 +0,0 @@
function [ ipaddress ] = getLocalIP()
%GETLOCALIP returns the ipaddress of the current windows machine
[status,result]=system('ipconfig');
if ~(status == 0)
error('Failed to find local IP address');
end
[startIndex,endIndex] = regexp(result,'(?<=\n IPv4 Address[ \.]*: )([0-9]{1,3}\.?){4}');
if isempty(startIndex)
error('Failed to find local IP address');
end
for i = 1:length(startIndex)
ipaddress{i} = result(startIndex(i):endIndex(i));
end
end


+ 20
- 0
OOequipment/subfiles/getLocalIP.m 파일 보기

@@ -0,0 +1,20 @@
function [ ipaddress ] = getLocalIP()
%GETLOCALIP returns the ipaddress of the current windows machine
if ispc
% Code to run on Windows plaform
[status,result]=system('ipconfig');
if ~(status == 0)
error('Failed to find local IP address');
end
[startIndex,endIndex] = regexp(result,'(?<=\n IPv4 Address[ \.]*: )([0-9]{1,3}\.?){4}');
if isempty(startIndex)
error('Failed to find local IP address');
end
for i = 1:length(startIndex)
ipaddress{i} = result(startIndex(i):endIndex(i));
end
else
error('Function only available on Windows');
end
end


불러오는 중...
취소
저장