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

2 visualizaciones (últimos 30 días)
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?

Respuestas (1)

aditi bagora
aditi bagora el 20 de Oct. de 2023
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

Categorías

Más información sobre MATLAB Support Package for Raspberry Pi Hardware en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by