The purpose of the operation was to reposition a compressed nerve in his elbow.
Manager Terry Collins announced on Monday that Matz was headed to the disabled list, but did not specify the problem at that time.
"This is not an injury," Collins said. "It's just an issue of ... he needs to shut it down for a little while. If he had to, he could pitch tomorrow."
Matz was scheduled to pitch Tuesday against the Arizona Diamondbacks, but he was replaced.
Matz, 26, began the season on the disabled list and has been struggling since his return, posting a 2-7 mark with a 6.08 ERA. He is 0-6 with a 10.19 ERA in his last eight starts.
Last season, Matz went 9-8 with a 3.40 ERA.
He is expected to be ready for Opening Day in 2018.