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.

Leveraging Large Language Models for MATLAB to Python Translation

Rocco Pietrini
2025-01-01

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.
2025
Code translation
LLM
MATLAB
Numerical computation
Python
Software reuse
File in questo prodotto:
Non ci sono file associati a questo prodotto.

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/20.500.12606/31646
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 0
social impact