Using python in matlab - substitute for []

4 visualizaciones (últimos 30 días)
Albert Passy
Albert Passy el 26 de Jul. de 2018
Respondida: Matthew Esch el 30 de Jul. de 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)

Respuestas (1)

Matthew Esch
Matthew Esch el 30 de Jul. de 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

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by