Based on the study of the Matlab rapid prototyping technology, the rapid prototyping design approach is presented, which is widely applicable to all kinds of microcontroller. Through the modification of the system target file, the automatic code generation function of the Matlab could support more microcontrollers. The rapid prototyping of in-wheel motor controller is designed through this approach. Then the embedded C codes are generated according to the vector control algorithm model which is validated by simulation, and the rapid prototyping of in-wheel motor controller is achieved. The proposed approach is validated through the comparison to hand-written code.