Programming: A Starter Project Using MATLAB with Python
Information
This curriculum module contains interactive
MATLAB® live scripts
that teach fundamental concepts and basic terminology related to
programming computers. This module explores interactions between systems
by using the OpenWeather API and calling into Python from MATLAB.
Programming: A Starter Project Using MATLAB with Python covers
downloading and installing a Live Task to run Python code, accessing the OpenWeather API
to check the weather, and choosing how to package
the weather reports into your personalized weather dashboard.
You can use these live scripts as demonstrations in a lecture, class activities,
or interactive assignments outside of class. The module is divided into
two interactive scripts and an example script: setting up your environment
to run Python from MATLAB in UsingPythonWithMATLAB.mlx,
exploring the API with CheckingTheWeather.mlx, and the
example SampleWeatherDashboard.mlx.
The instructions inside the live scripts will guide you through the exercises and activities.
Get started with each live script by running it one section at a time. To stop running the script
or a section midway (for example, when an animation is in progress), use the Stop button in the
RUN section of the Live Editor tab in the MATLAB Toolstrip.
If you are an instructor who would like solutions, or if you find an issue or have a suggestion,
email the MathWorks online teaching team at
onlineteaching@mathworks.com.
Related Courseware Modules
Prerequisites
This module assumes familiarity with basic programming concepts such as variables,
data types, and functions, structures including arrays and structs, and control flows
including if/else as well as how to use them in MATLAB. These ideas are all presented
with interactive examples in
Fundamentals of Programming,
Programming: Organizing Data, and
Programming: Structuring Code .
Getting Started
Products
MATLAB® and Symbolic Toolbox™
Scripts
Organization of Programming: A Starter Project Using MATLAB with Python
Script
In this script, you will...
Setting up MATLAB to run Python code
Reading and Accessing the OpenWeather API
checkweather.py to make an API call to OpenWeather.checkweather.py,
including data type conversions, unit conversions, and data
visualization options.
Example Weather Dashboard
Copyright 2022 The MathWorks™, Inc.