Computer Engineering & Science ›› 2025, Vol. 47 ›› Issue (06): 1041-1049.
• Software Engineering • Previous Articles Next Articles
GUO Rui1,XU Wenhao1,XIE Pengzhi2,YANG Wei2,SONG You1
Received:
Revised:
Online:
Published:
Abstract: MATLAB is widely used in various stages of industrial product development. However, in practical engineering applications, the mechanistic models built in MATLAB often need to be decoupled from the MATLAB runtime environment and integrated into real-world engineering systems. Thus, a tool for rapidly converting MATLAB models into deployable engineering solutions is required. To address this, this paper proposes M2P (MATLAB-to-Python), a converter based on abstract syntax tree (AST). The converter involves transforming source code into an AST structure, analyzing it, and applying substitution rules to generate equivalent Python code. Comparative experiments demonstrate that the proposed converter achieves superior conversion performance compared to existing MATLAB-to-Python converters.
Key words: code conversion, MATLAB-to-Python, abstract syntax tree (AST)
GUO Rui1, XU Wenhao1, XIE Pengzhi2, YANG Wei2, SONG You1. MATLAB-to-Python code converter based on AST[J]. Computer Engineering & Science, 2025, 47(06): 1041-1049.
0 / / Recommend
Add to citation manager EndNote|Ris|BibTeX
URL: http://joces.nudt.edu.cn/EN/
http://joces.nudt.edu.cn/EN/Y2025/V47/I06/1041