Using python in matlab - substitute for []

2 views (last 30 days)
Albert Passy
Albert Passy on 26 Jul 2018
Answered: Matthew Esch on 30 Jul 2018
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)

Answers (1)

Matthew Esch
Matthew Esch on 30 Jul 2018
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

Tags

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!