MATLAB Examples

Call Methods on Python Variables

This example shows how to update a Python® list of folder names using the append method.

Create a list of folders P using the Python sys.path variable.

P = py.sys.path;

Display the Python functions for a list type.

Methods for class py.list:

append   clear    eq       gt       le       mtimes   pop      sort     
cell     copy     extend   index    list     ne       remove   
char     count    ge       insert   lt       plus     reverse  

Call "methods 'handle' " for methods of py.list inherited from handle.

Read the documentation for append.'list.append')
Help on method_descriptor in list:

list.append = append ... 
    L.append object  -> None -- append object to end

Add the current folder to the end of the path.


Display the number of folders on the path. The list has py.len elements. Your value might be different. The type of this number is

ans = 

  Python int with properties:

    denominator: [1×1]
           imag: [1×1]
      numerator: [1×1]
           real: [1×1]