Depending on your OS, read one of these two solutions:
Both use the /r (or -r) command line argument when starting Matlab, and pass the command (script or function) to run when starting Matlab. If you want Matlab to exit when the script or function is finished, simply put the exit command at the end of that script or function. Of course, that script or function must exist and be on the Matlab path. There is a lot more detail in the links, especially the first one (most of which applies to both Windows and Linux).
Example (Windows):
matlab /r YourScript
You can put this in a bat file or a shell script with whatever additional processing you need.
