not sure what a .m file is - Are you referring to MDIF files? in any case, you might have better luck posting to the EEsof forum:
The RF toolbox in Matlab has built-in functions to create s2p files.
If you don't have the RF toolbox, the following entry on the matlabcentral has a function that can read and write sNp filesS-parameter toolbox (+ Z, Y, H, G, ABCD, T) - File Exchange - MATLAB Central
Retrieving data ...