2016年9月11日 星期日

Matlab Coder - Change the Array Size

We had introduced the concept of Matlab Coder Toolbox. In here, we introduce how to change the array size. If we set the array size to a fixed number, the generated C or C++ code is fixed, too (For static memory allocation, we cannot set flexible array size. I will introduce dynamic memory allocation later, which can set array size with flexible)

We go to modify the header and source files, the modified files are shown below (data type to pointer).









The main program is shown below (now we can change array size arbitrarily), the result would be correctly:
I will introduce dynamic memory allocation and complex value later.

沒有留言:

張貼留言