Skip to content

Commit b4580d3

Browse files
committed
Initial commit
0 parents  commit b4580d3

File tree

108 files changed

+768
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+768
-0
lines changed

.gitattributes

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
*.fig binary
2+
*.mat binary
3+
*.mdl binary diff merge=mlAutoMerge
4+
*.mdlp binary
5+
*.mexa64 binary
6+
*.mexw64 binary
7+
*.mexmaci64 binary
8+
*.mlapp binary
9+
*.mldatx binary
10+
*.mlproj binary
11+
*.mlx binary
12+
*.p binary
13+
*.sfx binary
14+
*.sldd binary
15+
*.slreqx binary merge=mlAutoMerge
16+
*.slmx binary merge=mlAutoMerge
17+
*.sltx binary
18+
*.slxc binary
19+
*.slx binary merge=mlAutoMerge
20+
*.slxp binary
21+
22+
## Other common binary file types
23+
*.docx binary
24+
*.exe binary
25+
*.jpg binary
26+
*.pdf binary
27+
*.png binary
28+
*.xlsx binary

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# List of untracked files to ignore
2+
3+
*.asv
4+
*.zip
5+
*.pyc
6+
*.pyc
7+
*.vs
8+
*TestOutput

CommentingCode.mlx

10.5 KB
Binary file not shown.

Debugging.mlx

49.4 KB
Binary file not shown.

Functions.mlx

49 KB
Binary file not shown.

HelperFunctions/OpenOverview.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function OpenOverview
2+
% Open the overview file
3+
open("Overview.html")
4+
5+
% Close the current script
6+
close(matlab.desktop.editor.getActive)
7+
end

HelperFunctions/Overview.html

Lines changed: 329 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,329 @@
1+
2+
<!DOCTYPE html
3+
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4+
<html><head>
5+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6+
<!--
7+
This HTML was auto-generated from MATLAB code.
8+
To make changes, update the MATLAB code and republish this document.
9+
--><title>Programming: Structuring Code</title><meta name="generator" content="MATLAB 9.13"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2022-08-01"><meta name="DC.source" content="Overview.m"><style type="text/css">
10+
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
11+
12+
html { min-height:100%; margin-bottom:1px; }
13+
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
14+
html body td { vertical-align:top; text-align:left; }
15+
16+
h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
17+
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
18+
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }
19+
20+
a { color:#005fce; text-decoration:none; }
21+
a:hover { color:#005fce; text-decoration:underline; }
22+
a:visited { color:#004aa0; text-decoration:none; }
23+
24+
p { padding:0px; margin:0px 0px 20px; }
25+
img { padding:0px; margin:0px 0px 20px; border:none; }
26+
p img, pre img, tt img, li img, h1 img, h2 img { margin-bottom:0px; }
27+
28+
ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
29+
ul li { padding:0px; margin:0px 0px 7px 0px; }
30+
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
31+
ul li ol li { list-style:decimal; }
32+
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
33+
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
34+
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
35+
ol li ol li { list-style-type:lower-alpha; }
36+
ol li ul { padding-top:7px; }
37+
ol li ul li { list-style:square; }
38+
39+
.content { font-size:1.2em; line-height:140%; padding: 20px; }
40+
41+
pre, code { font-size:12px; }
42+
tt { font-size: 1.2em; }
43+
pre { margin:0px 0px 20px; }
44+
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
45+
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }
46+
pre.error { color:red; }
47+
48+
@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }
49+
50+
span.keyword { color:#0000FF }
51+
span.comment { color:#228B22 }
52+
span.string { color:#A020F0 }
53+
span.untermstring { color:#B20000 }
54+
span.syscmd { color:#B28C00 }
55+
span.typesection { color:#A0522D }
56+
57+
.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
58+
.footer p { margin:0px; }
59+
.footer a { color:#878787; }
60+
.footer a:hover { color:#878787; text-decoration:underline; }
61+
.footer a:visited { color:#878787; }
62+
63+
table th { padding:7px 5px; text-align:left; vertical-align:middle; border: 1px solid #d6d4d4; font-weight:bold; }
64+
table td { padding:7px 5px; text-align:left; vertical-align:top; border:1px solid #d6d4d4; }
65+
66+
67+
68+
69+
70+
</style></head><body><div class="content"><h1>Programming: Structuring Code</h1><p>
71+
<span style="font-family:Arial">
72+
<span style="font-size:12pt">
73+
<h2> Information </h2>
74+
This curriculum module contains interactive
75+
<a href="https://www.mathworks.com/products/matlab/live-editor.html">MATLAB&reg; live scripts</a>
76+
that teach fundamental concepts and basic terminology related to
77+
programming computers. This module focuses on organizing code into
78+
functions, describing, debugging, and sharing code.
79+
<br>
80+
<br>
81+
<a href=#module>Programming: Structuring Code</a> covers
82+
<a href=#functions>functions</a>, adding
83+
<a href=#comments>comments</a> to code, <a href=#debugging>debugging</a>, and
84+
<a href=#sharing>sharing</a> code.
85+
<br>
86+
<br>
87+
You can use these live scripts as lecture demonstrations, class activities,
88+
or interactive assignments outside class. The module is divided into
89+
four scripts organized by topic: functions, comments, debugging, and
90+
sharing code.
91+
<br>
92+
<br>
93+
The instructions inside the live scripts will guide you through the exercises and activities.
94+
Get started with each live script by running it one section at a time. To stop running the script
95+
or a section midway (for example, when an animation is in progress), use the <img src="../Images/end_24.png" height="16" style="vertical-align:top"> Stop button in the
96+
RUN section of the Live Editor tab in the MATLAB Toolstrip.
97+
<br>
98+
<br>
99+
If you find an issue or have a suggestion, email the MathWorks online teaching team at
100+
<a
101+
102+
<br>
103+
<br>
104+
<h2> Prerequisites </h2>
105+
These scripts assume familiarity with MATLAB and general programming knowledge
106+
at the level covered in the <a href="https://github.com/MathWorks-Teaching-Resources/Fundamentals-of-Programming">
107+
Fundamentals of Programming</a> interactive examples. The familiarity with MATLAB could
108+
also be acquired in <a href="https://www.mathworks.com/learn/tutorials/matlab-onramp.html">MATLAB
109+
Onramp</a>.
110+
<br>
111+
<br>
112+
<h2> Getting Started </h2>
113+
<ol>
114+
<li>
115+
Get started with each topic by clicking the link in the first column of the table below to access the
116+
full script example. </li>
117+
<li>The instructions inside each live script will walk
118+
you through the live scripts and related functions.
119+
</li>
120+
</ol>
121+
<h2> Products </h2>
122+
MATLAB&reg;
123+
<br>
124+
<br>
125+
<h2> <a name="module"; style = "text-decoration: none; color: inherit">Scripts</a> </h2>
126+
<table border=1 style="margin-left:20px; cellpadding:15px;">
127+
<caption><h3>Organization of the Programming: Structuring Code Module</h3></caption>
128+
<tr>
129+
<th scope="col"><a name="fullscripts"></a>Topic</th>
130+
<th scope="col"> In this script, students will... </th>
131+
</tr>
132+
<tr>
133+
<th scope="row" style="text-align: center;">
134+
<a name="functions"; href="matlab:edit
135+
Functions.mlx;"><b>Functions</b> <br><br>
136+
<img src="../Images/Refactor.png" width="100"> </a>
137+
</th>
138+
<td>
139+
<ul style="margin-top:5px; margin-bottom:10px">
140+
<li> use mathematical functions to use MATLAB as a calculator. </li>
141+
<li> use the documentation to locate functions and determine how to use
142+
them.</li>
143+
<li> write simple functions with inputs, outputs, and side effects, and ensure the functions are on your MATLAB path.</li>
144+
<li> pass functions as arguments by using function handles. </li>
145+
</ul>
146+
</td>
147+
</tr>
148+
<tr>
149+
<th scope="row" style="text-align: center;">
150+
<a name="comments"; href="matlab:edit
151+
CommentingCode.mlx;"><b>Commenting and Documenting Code</b><br><br>
152+
<img src="../Images/Comment.png" width="100"> </a>
153+
</th>
154+
<td>
155+
<ul style="margin-top:5px; margin-bottom:10px">
156+
<li> write comments and documentation for a self-defined function.</li>
157+
<li> select meaningful variable names and add code and
158+
documentation to an existing function.</li>
159+
</ul>
160+
</td>
161+
</tr>
162+
<tr>
163+
<th scope="row" style="text-align: center;">
164+
<a name="debugging"; href="matlab:edit Debugging.mlx;"><b>Debugging
165+
Code</b><br> <br>
166+
<img src = "../Images/Step.png" width="100"></a>
167+
</th>
168+
<td>
169+
<ul style="margin-top:5px; margin-bottom:10px">
170+
<li> identify warning messages and locate and fix the problem. </li>
171+
<li> locate and fix syntax errors. </li>
172+
<li> recognize and isolate run-time errors. </li>
173+
</ul>
174+
</td>
175+
</tr>
176+
<tr>
177+
<th scope="row" style="text-align: center;">
178+
<a name="sharing"; href="matlab:edit SharingCode.mlx;"><b>Sharing
179+
Code</b> <br><br>
180+
<img src = "../Images/Git-Icon.png" width="100"> </a>
181+
</th>
182+
<td>
183+
<ul style="margin-top:5px; margin-bottom:10px">
184+
<li> add scripts to a project. </li>
185+
<li> clone a GitHub repository. </li>
186+
<li> use the Compare tool to see differences between two versions of the
187+
same live script. </li>
188+
</ul>
189+
</td>
190+
</tr>
191+
</table>
192+
<br>
193+
</span>
194+
</span>
195+
</p><p>Copyright 2022 The MathWorks&#8482;, Inc.</p><p class="footer"><br><a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2022b</a><br></p></div><!--
196+
##### SOURCE BEGIN #####
197+
%% Programming: Structuring Code
198+
%
199+
% <html>
200+
% <span style="font-family:Arial">
201+
% <span style="font-size:12pt">
202+
% <h2> Information </h2>
203+
% This curriculum module contains interactive
204+
% <a href="https://www.mathworks.com/products/matlab/live-editor.html">MATLAB&reg; live scripts</a>
205+
% that teach fundamental concepts and basic terminology related to
206+
% programming computers. This module focuses on organizing code into
207+
% functions, describing, debugging, and sharing code.
208+
% <br>
209+
% <br>
210+
% <a href=#module>Programming: Structuring Code</a> covers
211+
% <a href=#functions>functions</a>, adding
212+
% <a href=#comments>comments</a> to code, <a href=#debugging>debugging</a>, and
213+
% <a href=#sharing>sharing</a> code.
214+
% <br>
215+
% <br>
216+
% You can use these live scripts as lecture demonstrations, class activities,
217+
% or interactive assignments outside class. The module is divided into
218+
% four scripts organized by topic: functions, comments, debugging, and
219+
% sharing code.
220+
% <br>
221+
% <br>
222+
% The instructions inside the live scripts will guide you through the exercises and activities.
223+
% Get started with each live script by running it one section at a time. To stop running the script
224+
% or a section midway (for example, when an animation is in progress), use the <img src="../Images/end_24.png" height="16" style="vertical-align:top"> Stop button in the
225+
% RUN section of the Live Editor tab in the MATLAB Toolstrip.
226+
% <br>
227+
% <br>
228+
% If you find an issue or have a suggestion, email the MathWorks online teaching team at
229+
% <a
230+
231+
% <br>
232+
% <br>
233+
% <h2> Prerequisites </h2>
234+
% These scripts assume familiarity with MATLAB and general programming knowledge
235+
% at the level covered in the <a href="https://github.com/MathWorks-Teaching-Resources/Fundamentals-of-Programming">
236+
% Fundamentals of Programming</a> interactive examples. The familiarity with MATLAB could
237+
% also be acquired in <a href="https://www.mathworks.com/learn/tutorials/matlab-onramp.html">MATLAB
238+
% Onramp</a>.
239+
% <br>
240+
% <br>
241+
% <h2> Getting Started </h2>
242+
% <ol>
243+
% <li>
244+
% Get started with each topic by clicking the link in the first column of the table below to access the
245+
% full script example. </li>
246+
% <li>The instructions inside each live script will walk
247+
% you through the live scripts and related functions.
248+
% </li>
249+
% </ol>
250+
% <h2> Products </h2>
251+
% MATLAB&reg;
252+
% <br>
253+
% <br>
254+
% <h2> <a name="module"; style = "text-decoration: none; color: inherit">Scripts</a> </h2>
255+
% <table border=1 style="margin-left:20px; cellpadding:15px;">
256+
% <caption><h3>Organization of the Programming: Structuring Code Module</h3></caption>
257+
% <tr>
258+
% <th scope="col"><a name="fullscripts"></a>Topic</th>
259+
% <th scope="col"> In this script, students will... </th>
260+
% </tr>
261+
% <tr>
262+
% <th scope="row" style="text-align: center;">
263+
% <a name="functions"; href="matlab:edit
264+
% Functions.mlx;"><b>Functions</b> <br><br>
265+
% <img src="../Images/Refactor.png" width="100"> </a>
266+
% </th>
267+
% <td>
268+
% <ul style="margin-top:5px; margin-bottom:10px">
269+
% <li> use mathematical functions to use MATLAB as a calculator. </li>
270+
% <li> use the documentation to locate functions and determine how to use
271+
% them.</li>
272+
% <li> write simple functions with inputs, outputs, and side effects, and ensure the functions are on your MATLAB path.</li>
273+
% <li> pass functions as arguments by using function handles. </li>
274+
% </ul>
275+
% </td>
276+
% </tr>
277+
% <tr>
278+
% <th scope="row" style="text-align: center;">
279+
% <a name="comments"; href="matlab:edit
280+
% CommentingCode.mlx;"><b>Commenting and Documenting Code</b><br><br>
281+
% <img src="../Images/Comment.png" width="100"> </a>
282+
% </th>
283+
% <td>
284+
% <ul style="margin-top:5px; margin-bottom:10px">
285+
% <li> write comments and documentation for a self-defined function.</li>
286+
% <li> select meaningful variable names and add code and
287+
% documentation to an existing function.</li>
288+
% </ul>
289+
% </td>
290+
% </tr>
291+
% <tr>
292+
% <th scope="row" style="text-align: center;">
293+
% <a name="debugging"; href="matlab:edit Debugging.mlx;"><b>Debugging
294+
% Code</b><br> <br>
295+
% <img src = "../Images/Step.png" width="100"></a>
296+
% </th>
297+
% <td>
298+
% <ul style="margin-top:5px; margin-bottom:10px">
299+
% <li> identify warning messages and locate and fix the problem. </li>
300+
% <li> locate and fix syntax errors. </li>
301+
% <li> recognize and isolate run-time errors. </li>
302+
% </ul>
303+
% </td>
304+
% </tr>
305+
% <tr>
306+
% <th scope="row" style="text-align: center;">
307+
% <a name="sharing"; href="matlab:edit SharingCode.mlx;"><b>Sharing
308+
% Code</b> <br><br>
309+
% <img src = "../Images/Git-Icon.png" width="100"> </a>
310+
% </th>
311+
% <td>
312+
% <ul style="margin-top:5px; margin-bottom:10px">
313+
% <li> add scripts to a project. </li>
314+
% <li> clone a GitHub repository. </li>
315+
% <li> use the Compare tool to see differences between two versions of the
316+
% same live script. </li>
317+
% </ul>
318+
% </td>
319+
% </tr>
320+
% </table>
321+
% <br>
322+
% </span>
323+
% </span>
324+
% </html>
325+
%
326+
% Copyright 2022 The MathWorks(TM), Inc.
327+
328+
##### SOURCE END #####
329+
--></body></html>

HelperFunctions/checkBuildWord.mlx

4.06 KB
Binary file not shown.

HelperFunctions/checkExercise5.mlx

4.27 KB
Binary file not shown.

HelperFunctions/checkMarkMidpoint.mlx

4.41 KB
Binary file not shown.

0 commit comments

Comments
 (0)