Curriculum Module
Created with R2024a. Compatible with R2024a and later releases.
This curriculum module contains interactive MATLAB® live scripts that teach fundamental concepts and basic terminology related to programming computers.
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.
You can use these live scripts as demonstrations in lectures, class activities, or interactive assignments outside class. 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 using the Run Python Code Live Task to run provided Python code, accessing the OpenWeather API to check the weather, extracting useful data from the API call, and using App Designer to create an app with a personalized weather display.
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.
Solutions are available upon instructor request. Contact the MathWorks teaching resources team if you would like to request solutions, provide feedback, or if you have a question.
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.
Use the link to download the module. You will be prompted to log in or create a MathWorks account. The project will be loaded, and you will see an app with several navigation options to get you started.
Download or clone this repository. Open MATLAB, navigate to the folder containing these scripts and double-click on MATLABwithPython.prj. It will add the appropriate files to your MATLAB path and open an app that asks you where you would like to start.
Ensure you have all the required products (listed below) installed. If you need to include a product, add it using the Add-On Explorer. To install an add-on, go to the Home tab and select Add-Ons > Get Add-Ons.
MATLAB® is used throughout. Tools from the Symbolic Math Toolbox™ are used to convert between different unit systems in the weather applications.
Introductory script |
In this script, students will... |
|
$\bullet$ check that an appropriate version of Python is installed and visible within MATLAB $\bullet$ explore the Run Python Code Live Task $\bullet$ try running Python commands and a Python script from MATLAB |
Investigatory script |
In this script, students will... |
|
$\bullet$ set up an account with OpenWeather to create your own API key $\bullet$ use existing Python code to make an API call to OpenWeather $\bullet$ use MATLAB to explore the data returned by the API call, including data type conversions and unit conversions |
Application script |
In this script, students will... |
|
$\bullet$ use App Designer to build a custom app using the code from CheckingTheWeather.mlx $\bullet$ create callbacks, properties, and functions $\bullet$ design and organize a UI with drag and drop elements $\bullet$ reuse code from CheckingTheWeather in a new context |
Both of these apps require running Python from MATLAB, as set up in UsingMATLABwithPython and an OpenWeather API key, as set up in CheckingTheWeather.
The license for this module is available in the LICENSE.md.
Courseware Module |
Sample Content |
Available on: |
Fundamentals of Programming Learn the basics of how to make a computer accept, store, and compute with information |
|
GitHub |
Programming: Structuring Code Learn how to organize your code into functions, debug, comment, and share |
|
GitHub |
Programming: Organizing Data Learn more about strings, numeric data types, memory, and ways of storing data |
|
GitHub |
Or feel free to explore our other modular courseware content.
Looking for more? Find an issue? Have a suggestion? Please contact the MathWorks teaching resources team. If you want to contribute directly to this project, you can find information about how to do so in the CONTRIBUTING.md page on GitHub.
Many thanks to Blake Naccarato on his suggestions for improvement.
© Copyright 2024 The MathWorks™, Inc