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

6 ビュー (過去 30 日間)
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.

回答 (1 件)

Cam Salzberger
Cam Salzberger 2020 年 7 月 13 日
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

カテゴリ

Help Center および File ExchangeInstall Products についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by