Main Content

이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.

MATLAB에서 Python 호출하기

MATLAB®에서 직접 Python® 기능 호출

py. 접두사를 Python 이름에 추가하여 MATLAB에서 Python 라이브러리에 직접 액세스할 수 있습니다. MATLAB에서 Python 모듈 액세스하기 - 시작하기 항목을 참조하십시오. 예를 들면 다음과 같습니다.

py.list({'This','is a','list'})      % Call built-in function list
py.textwrap.wrap('This is a string') % Call wrap function in module textwrap
pyrun 또는 pyrunfile 함수를 사용하여 MATLAB이 직접 Python 인터프리터의 Python 명령문을 실행할 수 있습니다. 예를 들면 다음과 같습니다.
pyrun("l = ['A','new','list']")  % Call list in Python interpreter
자세한 내용은 MATLAB에서 직접 Python 기능 호출 항목을 참조하십시오.

그 대신 Python 응용 프로그램에서 MATLAB 함수를 호출하려는 경우 자세한 내용은 Python에서 MATLAB 호출하기 항목을 참조하십시오.

함수

모두 확장

pyenvPython 인터프리터의 디폴트 환경 변경 (R2019b 이후)
PythonEnvironmentPython 환경 정보 (R2019b 이후)
pyrunMATLAB에서 Python 명령문 실행하기 (R2021b 이후)
pyrunfileMATLAB에서 Python 스크립트 파일 실행 (R2021b 이후)
pyargsPython 함수에 대한 키워드 인수 생성
matlab.exception.PyExceptionCapture error information for Python exception

도움말 항목

MATLAB에서 Python 라이브러리 사용하기

MATLAB에서 Python 코드 실행하기

데이터 전달

문제 해결

Determine if Error is Python or MATLAB Error

Tips to determine if an error originates in Python or MATLAB code.

Python 지원의 제한 사항

MATLAB에서 지원되지 않는 Python 기능.

Handle Python Exceptions

MATLAB catches exceptions thrown by Python and converts them into a matlab.exception.PyException object.

Troubleshooting Matrix and Numeric Argument Errors

Error might be caused by input array with more than one non-singleton dimension.

Error Converting Elements of list or tuple

How to use string and numeric converters for list and tuple types.