The z-statistic normalises the data to have a mean of 0 and a standard deviation of 1, so using this syntax (from the documenation):
- Y = normpdf(X) uses the standard normal distribution (mu = 0, sigma = 1).
So here ‘X’ would be the z-statistic.
You will probably have to test for the number of inputs to your function (using nargin) and then have your function determine how to deal with the data it receives. For example if it receives only one input, it would interpret that as a z-statistic, if separate mu and sigma you would have to use other function syntax calls to normpdf.
So it seems normpdf can do everything you want. You just have to determine how to call it in your function.