Ask Your Question

Call rosrun from Matlab or alternative

asked 2015-04-26 03:56:20 -0600

charles gravatar image

updated 2015-04-26 04:59:57 -0600

I already have a ros package with an executable inside it. From the terminal this is what I do to execute it:

$ source ~/catkin_ws/devel/setup.bash
$ rosrun my_package my_executable

This executable print some text on the shell:

Hello world

I want to call this commands in Matlab and import the printed text. I tried creating a shell script like this:


source ~/catkin_ws/devel/setup.bash
rosrun my_package my_executable

and running it from Matlab in the following way:

[a,b] = system('~/./my_script')

but this is what I get:

[rosrun] Couldn't find executable named my_executable below /home/user/catkin_ws/src/my_package

The script works fine if called directly from the shell. How can I solve?

edit retag flag offensive close merge delete


Please include your script in your question.

ahendrix gravatar imageahendrix ( 2015-04-26 04:40:46 -0600 )edit

I've included the script. Any suggestions?

charles gravatar imagecharles ( 2015-04-27 03:24:38 -0600 )edit

I don't see anything obviously wrong with your script or the commands you're running. Are you certain your script works?

ahendrix gravatar imageahendrix ( 2015-04-27 03:48:01 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-31 21:51:00 -0600

umerhuzaifa gravatar image


It worked for me. I got the error too that you are mentioning but then I changed my MATLAB current directory to where the catkin_ws was, included it in the path (with the subfolders) and yes it started working.

I hope this helps someone who is still looking for an answer.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-04-26 03:56:20 -0600

Seen: 573 times

Last updated: Mar 31 '16