Programming-A-Starter-Project-Using-MATLAB-and-Python

version 1.0.3 (3.99 MB) by Emma Smith Zbarsky
A scaffolded project involving pulling and installing a Live Task, then using MATLAB and Python to access and analyze data from a web API.

655 Downloads

Updated Wed, 31 Aug 2022 20:11:03 +0000

From GitHub

View License on GitHub

Programming: A Starter Project Using MATLAB with Python

View Programming-A-Starter-Project-Using-MATLAB-and-Python on File Exchange Open in MATLAB Online

Curriculum Module
Created with R2022a. Compatible with R2022a and later releases.

Description

This curriculum module contains interactive 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 from a Git repository, accessing the OpenWeather API to check the weather, and choosing how to package the weather reports into your personalized weather display.

These lessons can be used as part of a lecture, as activities in an instructional setting, or as interactive assignments to be completed outside of class.

Get started with the Programming: A Starter Project Using MATLAB with Python interactive examples by downloading and unzipping the repository. Then, double-click the MATLABwithPython.prj file inside MATLAB®. From there, you can follow the landing page instructions to get started with the examples. 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, if a loop is running longer than intended), click the Stop button in the RUN section of the Live Editor tab in the MATLAB Toolstrip.

Prerequisite Domain Knowledge

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, Programming: Structuring Code.

Details

UsingMATLABwithPython.mlx Open in MATLAB Online

This script introduces the Run Python Code Live Task, as well as walking through checking that an appropriate version of Python is installed and visible to MATLAB.

Learning Goals: In this script, students will...

  • check that an appropriate version of Python is installed and visible within MATLAB.
  • download and install the Run Python Code Live Task.
  • try running Python commands and a Python script from MATLAB.

CheckingTheWeather.mlx Open in MATLAB Online

This script introduces the OpenWeather API, walking through setting up an account to get an API key, using an existing python script to access the API, and then investigation of the data that is returned.

Learning Goals: In this script, students will...

  • set up an account with OpenWeather to create your own API key.
  • use checkweather.py to make an API call to OpenWeather.
  • use MATLAB to explore the data returned by checkweather.py, including data type conversions, unit conversions, and data visualization options.

SampleWeatherDashboard.mlx Open in MATLAB Online

This script presents an example of a cleaned-up final product from following the directions in CheckingTheWeather.mlx. It uses a live script with Code Hidden to offer a pleasant user experience.

Learning Goals: In this script, students will

  • use hidden code interactions in live scripts to design a streamlined user experience.

Products

MATLAB®, Symbolic Math Toolbox™

License

The license for this module is available in the License.md file in this GitHub repository.

Support

Have any questions or feedback? Are you an instructor who would like solutions? Contact the MathWorks online teaching team.

Copyright 2022 The MathWorks, Inc.

Cite As

Emma Smith Zbarsky (2022). Programming-A-Starter-Project-Using-MATLAB-and-Python (https://github.com/MathWorks-Teaching-Resources/Programming-A-Starter-Project-Using-MATLAB-and-Python/releases/tag/v1.0.3), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2022a
Compatible with R2022a and later releases
Platform Compatibility
Windows macOS Linux
Communities
More Files in the  Distance Learning Community

Community Treasure Hunt

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

Start Hunting!

HelperFunctions

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.