The easiest way to do what you describe is to use the MATLAB interface for Raspberry Pi together with a Simulink model running on Arduino. Download and install MATLAB Support Package for Raspberry Pi Hardware and Simulink Support Package for Arduino Hardware first and foremost.
Create a model that runs on Arduino and receives commands via a Serial Receive block. Deploy this model to your Arduino board. Then connect your Raspberry Pi and Arduino boards using serial protocol. You can connect an Arduino to a Raspberry Pi using serial in a couple of ways. The following site describes different methods: http://conoroneill.net/connecting-an-arduino-to-raspberry-pi-for-the-best-of-both-worlds/. I personally used option 4.
You can then connect to your Raspberry Pi from MATLAB using the raspi API, create a serialdev object and send commands to your Arduino over Raspberry Pi. Make sure that when you create a serial object, you use '/tty/AMA0' as the port and specify the correct baud rate (usually 9600). The Simulink model running on the Arduino will receive serial commands you sent from your host PC running MATLAB. It is up to you to define what the model running on Arduino does with the serial commands you sent.