1. A computer-implemented method comprising: generating a model implemented in one of a block diagram programming environment or a statechart programming environment, the model having a special matrix language block, a functionality of the special matrix language block being implemented at least in part by a matrix language program written in a first programming language by a user; automatically generating code for the special matrix language block in a second programming language from the first programming language without requiring the user to provide instructions in the second programming language for the special matrix language block and without requiring the user to provide instructions on how to generate code in the second programming language for the special matrix language block, the second programming language being a high-level programming language; generating code in the second programming language for the model, the code for the model including the code generated in the second programming language for the special matrix language block; and storing the generated code in the second programming language for the model in a storage device or a memory.