The published carry-on dimensions (28" x 22" x 14" in) are considerably larger than airline carry-on dimensions, and those are rarely enforced in my experience. On the other hand, it looks like all the San Joquin trains handle checked luggage, so as long as you check it at least 30 minutes before your train departs, it should arrive when you do. When you check the bag, you will be given a claim check which you will need in Merced to reclaim your luggage. (It may take a few extra minutes for luggage to be unloaded from the baggage car and brought to the station for claiming.)