Help on reading serial data

Yeah, I know the serial doesn't send anything, but you got my point, hehe.

Right now I'm just storing the whole packet in a variable, but what I need is to 'filter' the packet and store only what I need, that is, the 'mx' and 'my' values. How can I get only these values and store 'em into separate buffers?