Simulating C code in Matlab - Template and examples