Using python in matlab - substitute for []

1 次查看(过去 30 天)
So I'm trying to call a python object that is indexed with square brackets []. I can't use the underlying function (__getitem__()). So How do I make this call: worksheet.row_dimensions[1] ? (Python code)

回答(1 个)

Matthew Esch
Matthew Esch 2018-7-30
I understand you are using Python from MATLAB and are having issue indexing into a Python Object.
Is this object you are trying to index a custom created Python class/container or a builtin Python container such as "list"?
If you are trying to index into a Python built-in structure, please see the following documentation: https://www.mathworks.com/help/matlab/matlab_external/accessing-elements-in-python-container-types.html
If you are trying to index into a Python Object that does not inherit from collections.Sequence or collections.Mapping, this is currently a limitation with MATLAB. More information about unsupported Python indexing can be found at: https://www.mathworks.com/help/matlab/matlab_external/limitations-to-indexing-into-python-objects.html?s_tid=answers_rc2-3_p6_MLT

类别

Help CenterFile Exchange 中查找有关 Call Python from MATLAB 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by