programming: structuring code
87.0 次下载
更新时间 2023/1/27
来自 github
programming: structuring code -凯发k8网页登录
or
curriculum module
created with r2021b. compatible with r2021b and later releases.
description
this curriculum module contains interactive that teach fundamental concepts and basic terminology related to programming computers. this module focuses on organizing code into functions, describing, debugging, and sharing code.
these scripts can be used as part of a lecture, as activities in an instructional setting, or as interactive assignments to be completed outside class.
##get started with the programming: structuring code interactive examples## by downloading and unzipping the repository. then, double-click the structuringcode.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 floating point doubles and strings, structures including constants, vectors, matrices, and arrays, and control flows including if/else, for loops, and while loops, as well as how to use them in matlab. these ideas are all presented with interactive examples in .
details
functions.mlx
organizing code into functions improves the readability, reusability, and ease of testing. this script addresses built-in functions, refactoring code to create functions, local functions, functions defined in their own files, programmatic scope and the matlab path, and how to pass functions as arguments to other functions.
learning goals: in this script, students will...
- use mathematical functions to use matlab as a calculator.
- use the documentation to locate functions and determine how to use them.
- write simple functions with inputs, outputs, and side effects, and ensure the functions are on your matlab path.
- pass functions as arguments by using function handles.
debugging.mlx
everyone makes mistakes when coding or interacting with computer programs, but you can fix these mistakes. this script introduces the matlab code analyzer, errors, warnings, breakpoints, stepping, and other tools for minimizing errors as well as identifying and removing bugs from your programs.
learning goals: in this script, students will
- identify warning messages and locate and fix the problem.
- locate and fix syntax errors.
- recognize and isolate run-time errors.
commentingcode.mlx
clearly documenting and communicating your thinking is essential to program with others or even your future self. this script addresses why and how you should document and comment your code.
learning goals: in this script, students will...
- write comments and documentation for a self-defined function.
- select meaningful variable names and add code and documentation to an existing function.
sharingcode.mlx
writing code for yourself is the first step, but when you create something useful or interesting, you also need to know how to share your work with others. this script offers a brief introduction to sharing your code with others.
learning goals: in this script, students will...
- add scripts to a project.
- clone a github repository.
- use the compare tool to see differences between two versions of the same live script.
related courseware modules
- fundamentals of programming on or
- programming: organizing data on or
products
matlab®
license
the license for this module is available in the file in this github repository.
support
have any questions or feedback? contact the
凯发官网入口首页 copyright 2022 the mathworks, inc.
引用格式
emma smith zbarsky (2023). programming: structuring code (https://github.com/mathworks-teaching-resources/programming-structuring-code/releases/tag/v1.0.4), github. 检索来源 .
matlab 版本兼容性
平台兼容性
windows macos linux标签
社区
community treasure hunt
find the treasures in matlab central and discover how the community can help you!
start hunting!探索实时编辑器
创建集代码、输出和格式化文本于一体的可执行脚本文档。
helperfunctions
tests
helperfunctions
版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.4.0 | see release notes for this release on github: |
|
|
1.0.3 | see release notes for this release on github: |
|
|
1.0.2 | see release notes for this release on github: |
|
|
1.0.1 | see release notes for this release on github: |
|
|
1.0.0 |
|