pass multi-dimentional array to a python function from matlab

1 回表示 (過去 30 日間)
Sabari Manohar Palaniappan
Sabari Manohar Palaniappan 2019 年 5 月 17 日
回答済み: Meet 2024 年 12 月 18 日
Hello,
I have a matrix with dimentions (329X439X3) type='uint8' in matlab. Right now I have trouble passing this matrix to a python function. I tried using py.numpy, but it results as shown below,
>> class(rgb_channel_time_one)
ans =
'uint8'
>> size(rgb_channel_time_one)
ans =
329 439 3
>> image = py.numpy.matrix(rgb_channel_time_one)
Error using py.numpy.matrix
Conversion of MATLAB 'uint8' to Python is only supported for 1-N vectors.
>> image = py.numpy.array(rgb_channel_time_one)
Error using py.numpy.array
Conversion of MATLAB 'uint8' to Python is only supported for 1-N vectors.
what is the cause of the error?

回答 (1 件)

Meet
Meet 2024 年 12 月 18 日
Hi Sabari,
I encountered a similar issue with MATLAB R2020a and earlier versions. However, this issue has been resolved starting from R2020b. I recommend upgrading MATLAB to the latest version.
I hope it helps you!!

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by