It absolutely is possible, and there are 3 main things you need need to do.
Create Python Action Server
This is pretty straight forward with lots of resources and demonstrations on how to set up an action client. I found this page on actionlib to be the most helpful. It demonstrates setting up your Catkin package structure, creating .action files as well as a Python simple action server.
Create Matlab Action Client
Even simpler is creating a Matlab action client to send goals to the Python action server. There are various overloaded signatures of the function as can be seen in the rosactionclient documentation. My preference is to use the function signature
[client,goalMsg] = rosactionclient(actionname)
This sets us up with a client to send goals to the action server as well as a blank goal message that we can modify and send. There is an example of its use on the aforementioned documentation page.
Facilitate Custom Messages in Matlab
Action servers may require the use of custom ROS messages (stored in .action files). Matlab has access to a lot of built in messages as can be seen with the command rosmsg list
. If you do not see the your action server's messages in the returned list then you need to follow these instructions for ROS Custom Message Support. I was not able to run these instructions on a Mac, but I was able to successfully run them on a Linux machine. Once I had the directory of generated messages on my Linux machine I was able to copy them to my Mac and they worked perfectly.
To answer this you'd have to figure out whether Matlab can create an action server.
If that is possible, then you can do what you are asking.
If not, then not.
thanks a lot @gvdhoom.As I understand I should write an action in c++ or python and a client in matlab.