Programming-A-Starter-Project-Using-MATLAB-and-Python
Curriculum Module
Created with R2022a. Compatible with R2022a 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.
If you are viewing this in a version of MATLAB prior to R2023b, you can view the learning outcomes for each script here.
Both of these apps require running Python from MATLAB, as set up in UsingMATLABwithPython and an OpenWeather API key, as set up in CheckingTheWeather.
- CurrentWeatherAppDemo.mlapp shows the results of working through CreateCurrentWeatherApp.
-
WeatherDisplay.mlapp shows one elaborated version of the basic current weather app.
For those with a legacy OpenWeather API key, or the willingness to sign up for the OneCall 3.0 API, the original weather forecasting exploration from this courseware module is included as well.
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
Zitieren als
Emma Smith Zbarsky (2024). Programming-A-Starter-Project-Using-MATLAB-and-Python (https://github.com/MathWorks-Teaching-Resources/Programming-A-Starter-Project-Using-MATLAB-and-Python/releases/tag/v2.0.0), GitHub. Abgerufen .
Kompatibilität der MATLAB-Version
Plattform-Kompatibilität
Windows macOS LinuxTags
Communitys
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.