MATLAB Examples

Create Python list Variable

This example shows how to create a list variable to pass to a Python® function.

students = py.list({'Robert','Mary','Joseph'})
students = 

  Python list with no properties.

    ['Robert', 'Mary', 'Joseph']

Display the number of students in the list.

n = py.len(students)
n = 

  Python int with properties:

    denominator: [1×1 py.int]
           imag: [1×1 py.int]
      numerator: [1×1 py.int]
           real: [1×1 py.int]

    3