Problem with Auto Reset (Mega and Uno)

So i have a program that works pretty well if i send the data with serial monitor, but if i try to send the data with matlab all the information of the variables in arduino is reset to 0.

I guess the problem is when every time the port is opened and closed the Auto Reset is doing its work. i want to deactivate this function with the resistor of 120ohms and the capacitor of 10uf but i don´t know how to wire them, because i have tried different things and what i got until now is that the program is writting 240 in the serial port, or that i am not able to read any other thing in the serial. Best Regards

When you disable the auto reset then you can not upload code.

You wire it up like this:-

I have not tried with just a resistor because it says that for the arduino uno it is needed a capacitor, do you think it would work with just that?. What happen if i put a bigger resistor?

If you use a bigger resistor it will not work.