Using MATLAB python engine and returning multiple matrices
조회 수: 2 (최근 30일)
이전 댓글 표시
I'm using MATLAB python engine to automate some data processing. I'm perfectly comfortable using this code to return the correlation coefficient matrix for two random columns:
import matlab.engine
eng = matlab.engine.start_matlab()
rndArray = eng.randn(10, 2)
R = eng.corrcoef(rndArray)
When I use this line in MATLAB:
[R, P] = corrcoef(rndArray)
It would also return the p-value matrix for the results. But the equivalent line in python:
[R, P] = eng.corrcoef(rndArray)
does not return two matrices. What am I doing wrong? How can I get multi results in python?
Thank you
댓글 수: 0
채택된 답변
Robert Snoeberger
2015년 10월 15일
편집: Robert Snoeberger
2015년 10월 15일
Use the nargout keyword argument [1].
R, P = eng.corrcoef(rndArray, nargout=2)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Call MATLAB from Python에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!