Create unknown amount of vectors automatically (no cell-arrays allowed due to compatibility issues with Python)
조회 수: 1(최근 30일)
I am looking to pass numeric data from Matlab to Python. As far as I'm concerned, the API does not support any kind of container, so no cells or structs are allowed. The idea is to have a function passing multiple vectors with each vector having info on one object (a car). The number of cars, i.e. the number of vectors to be created, is not known before runtime.
varargout creates a cell-array and is therefore unsuitable;
In Python, I can declare
and will get any number of arguments I create during runtime. Is there something similar in Matlab or is there any other trick?
I have considered combining all data into one vector and un-combining it once it has reached Python, this is not beautiful though.
(Better yet: Does someone know a container-type format which passes through R2018b-Python-API.)
Thank you in advance
Unsupported MATLAB Types for 2018 Python API
- Multidimensional char or cell arrays
- Structure arrays
- Sparse arrays
- categorical,table,containers.Map,datetime types
- MATLAB objects
- meta.class (py.class)
Pranjal Kaura 2021년 10월 27일
You could go through the link 'Pass Data to Python', particularly the 'Passing Matrices and Multidimensional Arrays' subsection to know more about passing multidimensional arrays from MATLAB to python.
Hope this helps!