Do it by having intimate knowledge of both languages. Normally instead of converting C program line-by-line you would convert function concepts. If you have a C function named foo(int a, int b) that returns the product of two numbers then just write the same function in matlib.
Don't ask me how to do it because I have no idea. If you don't either then you need to spend some time learning matlib and learn how to do it yourself.