MATLAB Examples

Pass dict Argument to Python Method

This example shows how to change a value in a dict variable using the Python® update method.

Create a menu of items and prices.

menu = py.dict(pyargs('soup',3.57,'bread',2.29,'bacon',3.91,'salad',5.00));

Update the price for bread using the Python dict type update method.

menu = 

  Python dict with no properties.

    {'bread': 2.5, 'salad': 5.0, 'bacon': 3.91, 'soup': 3.57}