Using MATLAB python engine and returning multiple matrices

3 ビュー (過去 30 日間)
Michael
Michael 2015 年 10 月 15 日
編集済み: Robert Snoeberger 2015 年 10 月 15 日
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

採用された回答

Robert Snoeberger
Robert Snoeberger 2015 年 10 月 15 日
編集済み: Robert Snoeberger 2015 年 10 月 15 日
Use the nargout keyword argument [1].
R, P = eng.corrcoef(rndArray, nargout=2)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCall MATLAB from Python についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by