Running Virtual Ubuntu Terminal commands via Matlab system() command : navigate to path and run command

4 Ansichten (letzte 30 Tage)
Hi! I am running ubuntu on a virtual machine and I want to send some terminal commands via matlab.
First, I want to set a path i.e. 'cd ~/interbotix_ws/src/interbotix_ros_arms/interbotix_gazebo/launch'
and then I want to run a command 'roslaunch gazebo.launch robot_name:=wx200'.
I am using system(cd ~/interbotix_ws/src/interbotix_ros_arms/interbotix_gazebo/launch') and then entering system('roslaunch gazebo.launch robot_name:=wx200'). However, it throws error. It doesn't seems that it navigates to the path where I want it to go.
Please help so that I can navigate to the path and run the other command successfully.

Antworten (1)

Cam Salzberger
Cam Salzberger am 13 Jul. 2020
Hey Ritish,
You should be able to simply use "&&" to run two commands sequentially on Linux. Make sure you use the syntax appropriate to the terminal you use.
Also, you may be able to provide the full path to the launch file, so you don't need to "cd" to it first. I'm not as sure about that though.
-Cam

Kategorien

Mehr zu Install Products finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by