Standalone Arduino interacting with Matlab?

I am working on a school project which uses Arduino as motor control and sensor reading hardware and send some of sensor data into computer.

We have a complicated calculation which decides which actuator needs to move and this calculation is too much arduino so we decided it is a good idea to calculate that on computer and then send this information into arduino. Arduino then will control the motor according to this information.

I tried Matlab arduino hardware support for this but I realized it is not Arduino working stand-alone and motor control performance is so poor when it is performed in computer as frequency of calculation is too low.

So, what I think is, If I uplaod an Arduino IDE program into my arduino and use Matlab to perform just that big calculation and send the result into Arduino as a serial data, It may perform as I desire.

However, I do not know how to make such connection between Matlab and Arduino. As I mentioned, I want a different code running in Arduino while Matlab collecting sensor data coming from Arduino and performing calculation, not programming Arduin from Matlab.

Every help is appreciated.
Regards...

You could program the Arduino to send data and receive MATLAB commands through the serial port.

You will have to devise your own serial command and data protocol for that, and implement it on both the Arduino and MATLAB.