⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getmyip.m

📁 A very small 250-line library (written entirely in MATLAB) that allows multiple MATLAB programs to t
💻 M
字号:
function ipa=getmyipif strcmp(computer,'PCWIN')  [s,m]=unix('ipconfig');  h=find((m>=65)&(m<=90));  m(h)=m(h)+32;  h=findstr(m,'ip address');  if isempty(h) h=findstr(m,'direcc'); end %try another lang  m(1:(h+10))=[];  m(1:min(find((m>=48)&(m<=57)))-1)=[];  ipa=m(1:min(find(xor((m<48)|(m>57),m==46)))-1);elseif isunix   [s m]=unix('hostname');    [s m]=unix(['nslookup ' m]);   h=find((m>=65)&(m<=90));   m(h)=m(h)+32;   m(1:findstr(m,'name:')+5)=[];   m(1:findstr(m,'address:')+8)=[];   m(1:min(find((m>=48)&(m<=57)))-1)=[];   ipa=m(1:min(find(xor((m<48)|(m>57),m==46)))-1);else   error(' Don''t know how to detect your IP address. Please adjust getmyip.m for your OS');end % check output is a valid ip addressh=find(ipa=='.');if length(h)~=3 ;  %ip must have 3 points !  error(' Don''t know how to detect your IP address. Please adjust getmyip.m for your OS');endipat=ipa;ipat(h)=[];if ~prod((ipat>=48)&(ipat<=57))  %remaining chars must be digits !   error(' Don''t know how to detect your IP address. Please adjust getmyip.m for your OS');end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -