0

I have imported an python ndarray as a cell in Matlab (data_cell) and now I would like to access the properties of this ndarray, more specifically the shape, to convert any cell to the right type with the right size in MatLab.

What I would like to do is:

data_convert_1 = reshape(double(py.array.array('d', ...
                      py.numpy.nditer(data_cell(2), pyargs('order', 'F')))), ...
                      shape);

But for this I need the original data shape, that is in the properties information, like in the image bellow:

enter image description here

How can I access this? or save for ex. [row,col] = data_cell(1,2).shape ?? This doesn't work

JCV
  • 447
  • 1
  • 5
  • 15
  • This seems related to your previous question (https://stackoverflow.com/questions/64263625/return-variables-from-python-to-matlab) however this one seems to lack information – Paolo Oct 08 '20 at 15:04
  • 1
    Not writing an answer because I can’t test this, but if `data_cell` is a cell array, you use `{}` to get an element out of it: `data_cell{1,2}.shape`. This results in a single array, you assign it to a single variable, you can’t unpack it like a tuple in Python. – Cris Luengo Oct 08 '20 at 17:01

0 Answers0