You create s in the beginning of your code, which is a serial port object. It can be used as any file handle, in particular with fprintf() as mentioned in your question. If you tried, e.g. with
.. but the command was not taken into account by the microcontroller, my first guess would be that you don't send the correct 'terminator'. See serial.fprintf and your device manual. Another thing that you could do is to read on your port to check whether you get some information, either after sending commands, or when you power your device on.. just to be sure that the device is not inert. Also, you don't "program a microcontroller" per se. The microcontroller was programmed with a code (a tiny "operating system" stored in flash, e2prom, or any kind of non-volatile memory) that is loaded at power on and manages serial communication as well as the electronics for driving motors on your device. This OS understands a set of commands (like XV=..) that was defined by people who built the device. So you don't want to "program a microcontroller in MATLAB", but send these "high level commands" to the device in the correct format.
Best Answer