Make the second to last line in step 2 this and it will work:
workOnExistingMatrix(mxGetPr(prhs[0]));
Here's the corrected MEX file:
//This is the MEX file (written in C)
#include "mex.h"
void workOnExistingMatrix(double* aMatrixCreatedInMatlab) {
aMatrixCreatedInMatlab[0] = 0.1234;
}
//The gateway function
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]) {
//This works =)
workOnExistingMatrix(mxGetPr(prhs[0]));
}