I use command [status,result] = system('arp -a'), to get the IP address of my computer. there are lots of IP in the variable 'result', such as dynamic, staticstic, etc.
meanwhile, the result are also found to be different at different day. for example, using the same command, the variable 'result' is different between yesterday and today.
just want know what paramters in the 'result' is fixed in the machine, which will not changed with time?
Thanks!
Yu

3 件のコメント

Steven Lord
Steven Lord 2018 年 11 月 7 日
What do you plan to do with this information? If we know your ultimate goal, we may be able to offer a way to achieve that goal without having to parse text returned by a system command.
Stephan
Stephan 2018 年 11 月 7 日
xingxingcui
xingxingcui 2024 年 8 月 30 日
using following matlab code to get computer IP address
% Use Java's InetAddress class to get the local host
host = java.net.InetAddress.getLocalHost();
% Get the IP address as a string
ipAddress = char(host.getHostAddress());
% Display the IP address
disp(['Local IP Address: ', ipAddress]);
Local IP Address: 10.168.118.61

サインインしてコメントする。

 採用された回答

Stephan
Stephan 2018 年 11 月 6 日
編集済み: Stephan 2018 年 11 月 6 日

0 投票

Hi,
try:
[~, result] = system('ipconfig')
result:
Windows-IP-Konfiguration
Ethernet-Adapter LAN-Verbindung:
Verbindungsspezifisches DNS-Suffix: **.*********.de
IPv4-Adresse . . . . . . . . . . : **.***.**.**
Subnetzmaske . . . . . . . . . . : 255.255.255.0
Standardgateway . . . . . . . . . : **.***.**.*
for more detailed information use:
[~, result] = system('ipconfig -all')
The arp gives the adress Resolution protocoll - not your IP adress.

3 件のコメント

Yu Li
Yu Li 2018 年 11 月 7 日
Thanks for your reply. I see there are lots of information with system('ipconfig -all').
could you please tell me which parameters are unique in a machine? Physical address and IPv4 address?
Walter Roberson
Walter Roberson 2018 年 11 月 7 日
IPv4 address is not likely to be unique for your machine.
Yu Li
Yu Li 2018 年 11 月 7 日
thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

質問済み:

2018 年 11 月 6 日

コメント済み:

2024 年 8 月 30 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by