Leveraging Large Language Models for MATLAB to Python Translation

Published: 01 Jan 2025, Last Modified: 27 Feb 2026CrossrefEveryoneRevisionsCC BY-SA 4.0
Abstract: The translation of MATLAB code into Python stands as a pivotal practice in software reuse, particularly in the conversion of research-oriented scripts into robust production-ready solutions. This shift not only offers a cost-effective alternative to the use of expensive MATLAB licenses for enterprises but also facilitates broader software reuse endeavors. This paper examines the transformative capacity inherent in leveraging general-purpose Large Language Models (LLMs) for the translation of MATLAB code into Python, specifically focusing on scientific scripts. The research thoroughly investigates the methodology underlying the utilization of LLMs to seamlessly migrate MATLAB-based numerical computation scripts into Python ecosystems. Through a comprehensive case study within the oil and gas sector, the paper illustrates tangible advantages, showcasing how the adoption of LLMs facilitates the deployment and integration of numerical computation scripts. The results underscore efficiency enhancements in code translation and address prevailing constraints, as evidenced in an experimental segment where diverse MATLAB scripts undergo translation and evaluation by a panel of domain experts.
Loading