How can I determine the hostname of a Raspberry Pi when connected from Matlab Online using deploy

2 ビュー (過去 30 日間)
Hi, I have two Raspberry Pi devices that I am using with Matlab Online, and I would like to be able to determine which one is being run from within (compiled) code run using deploy.
raspi.system only allows use of the ls commend when used from Matlab Online, so I can't do system('hostname'). I also tried hostname = getenv("HOSTNAME") but I'm not user it's working because
coder.extrinsic('disp')
hostname = getenv("HOSTNAME")
disp(sprintf('Environment variable HOSTNAME="%s"', hostname ) )
doesn't display anything on the console in Matlab Onlne.
Suggestions?

回答 (1 件)

aditi bagora
aditi bagora 2023 年 10 月 20 日
Hello Gregory,
I understand that you are looking for a way to determine the device being used when deploying code using MATLAB Online.
The support for running system commands in MATLAB Online is limited and accessing the "HOSTNAME" environment variable using the `getenv()` function may not provide the desired result.
To address this issue, I suggest considering the following approaches:
  • Utilize the properties such as "DeviceAddress" or "BoardName" of your `raspi` object. These properties can provide information about the specific device being used.
  • Alternatively, you can switch to the MATLAB desktop application, as it offers more extensive capabilities for running system commands compared to MATLAB Online.
Please refer the following links that provides more information on the issue.
Hope this helps!
Regards,
Aditi

カテゴリ

Help Center および File ExchangeMATLAB Support Package for Raspberry Pi Hardware についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by