Main Content


Execute system command on device



system(device,command) runs a command in the Linux® command shell on the ROS or ROS 2 device. This function does not allow you to run interactive commands.

system(device,command,'sudo') runs a command with superuser privileges.

response = system(___) runs a command using any of the previous syntaxes with the command shell output returned in response.


collapse all

Connect to a ROS device and run commands on the Linux(R) command shell.

Connect to a ROS device. Specify the device address, user name, and password of your ROS device.

d = rosdevice('','user','password');

Run a command that lists the contents of the Catkin workspace folder.

system(d,'ls /home/user/catkin_ws_test')
ans = 

Input Arguments

collapse all

ROS or ROS 2 device, specified as a rosdevice or ros2device object, respectively.

Linux command, specified as a character vector.

Example: 'ls -al'

Output Arguments

collapse all

Output from Linux shell, returned as a character vector.

Introduced in R2019b