There is an example here:
The link you provided really has the information you need to write an objective function. Your objective takes the table that MATLAB passes, and returns a real scalar value as the objective. The fields in the table are the optimization variables. In the example, the optimization variables are box and sigma, and the function works with x.box and x.sigma.
If you want to provide pseudocode for your objective, maybe we can help you turn it into the correct form.
MATLAB mathematical toolbox documentation