Simulating C code in Matlab - Templates and examples