フィルターのクリア

Passing numpy arrays into a python function from MATLAB

5 ビュー (過去 30 日間)
ohmstead
ohmstead 2018 年 11 月 20 日
回答済み: Nikilesh Chilkuru 2018 年 11 月 26 日
I need to pass in two MATLAB vectors into a python function, like so:
xfin = py.predictWithNet.predict_por_out(net, raw_x, raw_y); % xfin is a numpy ndarray
with raw_x and raw_y both being passed as numpy arrays instead of MATLAB single or double. Is there any way to do this?

回答 (1 件)

Nikilesh Chilkuru
Nikilesh Chilkuru 2018 年 11 月 26 日
You can create numpy arrays within the MATLAB and then pass this as arguments. You can create a numpy array in MATLAB as shown below:
A = py.numpy.array([2,3]) % this will create a numpy array "A" with values 2,3
% Similarly you can create numpy arrays raw_x and raw_y with appropriate values

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by