Skip to content

Commit c71d1f5

Browse files
committed
Updating to new structure
1 parent c526427 commit c71d1f5

File tree

156 files changed

+1159
-658
lines changed

Some content is hidden

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

156 files changed

+1159
-658
lines changed

.github/workflows/release.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Release Fundamentals of Programming across all supported releases of MATLAB
2+
3+
name: MATLAB Release
4+
5+
# Run workflow when a tag is created
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
# This workflow contains:
13+
# 1. a matrixed test job run across a bunch of releases of MATLAB
14+
# 2. a reporting job that summarizes the tests, and updates release badge
15+
test:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
MATLABVersion: [R2020a, R2020b, R2021a, R2021b, R2022a, R2022b]
20+
# The type of runner that the job will run on
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
25+
- uses: actions/checkout@v3
26+
27+
- name: Set up MATLAB
28+
uses: matlab-actions/setup-matlab@v1
29+
with:
30+
release: ${{ matrix.MATLABVersion }}
31+
32+
# Runs all tests in the project. Put results in a version specific subdirectory
33+
- name: Run tests
34+
uses: matlab-actions/run-command@v1
35+
with:
36+
command: addpath("buildutil"),testToolbox('ReportSubdirectory',"${{ matrix.MATLABVersion }}")
37+
38+
# Save the contents of the report directory from each release into a single artifact. Since each release makes their own directory, they all update the same artifact.
39+
- name: Save Report Directory
40+
uses: actions/upload-artifact@v3
41+
if: always()
42+
with:
43+
name: report
44+
path: report
45+
46+
# Report on what releases tested successfully.
47+
# Generate a draft release based on the tag
48+
# Recreate the tag with the final version of JSON files
49+
release:
50+
needs: test
51+
if: always()
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- uses: actions/checkout@v3
56+
with:
57+
ref: refs/heads/main
58+
59+
- name: Set up MATLAB
60+
uses: matlab-actions/setup-matlab@v1
61+
62+
# Copy all the reports down into the container
63+
- uses: actions/download-artifact@v3
64+
with:
65+
name: report
66+
path: report
67+
68+
# Generate the JSON for the releases tested badge
69+
- name: Generate tested with badge
70+
uses: matlab-actions/run-command@v1
71+
with:
72+
command: addpath("buildutil"),badgesforToolbox()
73+
74+
# Publish test results from all the releases
75+
- name: Publish Test Results
76+
uses: EnricoMi/publish-unit-test-result-action@v2
77+
if: always()
78+
with:
79+
junit_files: "report/*/test-results.xml"
80+
81+
# Commit the JSON for the MATLAB releases badge
82+
- name: commit changed files
83+
continue-on-error: true
84+
run: |
85+
git config user.name "${{ github.workflow }} by ${{ github.actor }}"
86+
git config user.email "<>"
87+
git commit report/badge/tested_with.json -m "Final checkins for release ${{ github.ref_name }}"
88+
git fetch
89+
git push
90+
91+
# Retag the repo so that the updated files are included in the release tag
92+
- name: update tag
93+
if: always()
94+
continue-on-error: true
95+
run: |
96+
git config user.name "${{ github.workflow }} by ${{ github.actor }}"
97+
git config user.email "<>"
98+
git tag -d "${{ github.ref_name }}"
99+
git push --delete origin ${{ github.ref_name }}
100+
git tag -m "Release ${{ github.ref_name }}" ${{ github.ref_name }}
101+
git push --tag
102+
103+
# Create the release
104+
- name: Create GitHub Release
105+
uses: ncipollo/release-action@v1
106+
with:
107+
draft: true
108+
generateReleaseNotes: true

.gitignore

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,55 @@
11
# List of untracked files to ignore
22

3-
*.asv
3+
# Autosave files
4+
*.asv
5+
*.m~
6+
*.autosave
7+
*.slx.r*
8+
*.mdl.r*
9+
10+
# MATLAB Drive
11+
*.MATLABDriveTag
12+
13+
# Compiled files
14+
*.mex*
15+
*.p
16+
17+
# Compressed files
18+
*.zip
19+
20+
# Packaged app and toolbox files
21+
*.mlappinstall
22+
*.mltbx
23+
24+
# Deployable archives
25+
*.ctf
26+
27+
# Generated helpsearch folders
28+
helpsearch*/
29+
30+
# Defined Simulink cache folder
31+
Utilities/SimulinkCache/*
32+
33+
# Standard code generation folders
34+
slprj/
35+
sccprj/
36+
codegen/
37+
38+
# Code generation file
39+
*.eep
40+
*.elf
41+
*.hex
42+
*.bin
43+
44+
# Cache files
45+
*.slxc
46+
47+
# Project settings
48+
Utilities/ProjectSettings.mat
49+
50+
# Test results
51+
SoftwareTests/TestResults_*
52+
53+
# Auto-generated from Scripts
54+
*/*/MyFavoriteChaosGameImage.png
55+
*/*/fileInfo.txt

.gitlab-ci.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
stages:
2+
- test
3+
4+
matlab-test-job:
5+
tags:
6+
- matlab
7+
stage: test
8+
script:
9+
- matlab -batch "openProject('FundamentalsofProgramming.prj'); results = runtests('IncludeSubfolders', true); disp(table(results)); assertSuccess(results);"

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contributing
2+
3+
>_If you believe you have discovered a security vulnerability, please **do not** open an issue or make a pull request. Follow the instructions in the [SECURITY.md](SECURITY.md) file in this repository._
4+
5+
Thank you for your interest in contributing to a MathWorks repository! We encourage contributions large and small to this repository.
6+
7+
**Contributions do not have to be code!** If you see a way to explain things more clearly or a great example of how to use something, please contribute it (or a link to your content). We welcome issues even if you don't code the solution. We also welcome pull requests to resolve issues that we haven't gotten to yet!
8+
9+
## How to give feedback
10+
* **Send us an email:** Contact the [MathWorks teaching resources team.](mailto:[email protected])
11+
* **Open an issue:** Start by [creating an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue) in the repository that you're interested in. That will start a conversation with the maintainer. When you are creating a bug report, please include as many details as possible. Please remember that other people do not have your background or understanding of the issue; make sure you are clear and complete in your description.
12+
13+
## How to contribute to the repository
14+
* **Work in your own public fork:** If you choose to make a contribution, you should [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo). This creates an editable copy on GitHub where you can write, test, and refine your changes. We suggest that you keep your changes small and focused on the issue you submitted.
15+
* **Sign a Contributor License Agreement (CLA):** We require that all outside contributors sign a [CLA](https://en.wikipedia.org/wiki/Contributor_License_Agreement) before we can accept your contribution. When you create a pull request (see below), we'll reach out to you if you do not already have one on file. Essentially, the CLA gives us permission to publish your contribution as part of the repository.
16+
* **Make a pull request:** "[Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)" is a confusing term, but it means exactly what it says: You're requesting that the maintainers of the repository pull your changes in. If you don't have a CLA on file, we'll reach out to you. Your contribution will be reviewed, and we may ask you to revise your pull request based on our feedback. Once everyone is satisfied, we'll merge your pull request into the repository.
17+
18+
## Guidelines
19+
20+
We don't have best practices for writing MATLAB&reg; code, but we do have some recommendations:
21+
22+
* You should not have any warnings or errors in the [code analyzer report](http://www.mathworks.com/help/matlab/matlab_prog/matlab-code-analyzer-report.html)
23+
* [Loren Shure's blog](https://blogs.mathworks.com/loren) has [great advice on improving your MATLAB code](https://blogs.mathworks.com/loren/category/best-practice/)
24+
* Examples should be written as [live scripts](https://www.mathworks.com/help/matlab/matlab_prog/what-is-a-live-script-or-function.html) or [Simulink&reg; models](https://www.mathworks.com/help/simulink/index.html).
25+
* We adhere to the [CommonMark](https://commonmark.org/) specification where it does not conflict with GitHub rendering. If you edit your Markdown in Visual Studio Code or a similar editor, it uses [markdownlint](https://github.com/DavidAnson/markdownlint) to highlight issues in your Markdown.
26+
27+
**Again, thanks for contributing, and we look forward to your issues and pull requests!**

CollectedProTips.mlx

-15 KB
Binary file not shown.

chaosGame.m renamed to FunctionLibrary/ChaosGame.m

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
% Initialize values for a randomly chosen starting point
2-
startingPoint = rand([1 2]);
2+
StartingPoint = rand([1 2]);
33
% Set the number of additional points to add
4-
numPts = 100;
4+
NumPts = 100;
55
% Initialize a variable to track the previous vertex.
6-
oldVertex = 0;
6+
OldVertex = 0;
77
% Initialize a vector of point values of the appropriate size
88
% For a large number of iterations, this is much more efficient than
99
% adding a new point to the end at each step which requires reallocating
1010
% memory for a different size array each time
11-
startingVals = startingPoint.*ones([numPts 1]);
11+
StartingVals = StartingPoint.*ones([NumPts 1]);
1212
% Graph a scatter plot of the first point and save a handle to
1313
% the scatter plot object for future reference
14-
s = scatter(startingVals(:,1),startingVals(:,2),".");
14+
s = scatter(StartingVals(:,1),StartingVals(:,2),".");
1515
% Set the x and y limits on the plot
1616
xlim([0 1])
1717
ylim([0 1])
@@ -22,28 +22,28 @@
2222
% Exercise 5 code goes here
2323

2424
% Implement the chaos game.
25-
for k = 1:numPts
26-
newVertex = randi(4,1);
25+
for k = 1:NumPts
26+
NewVertex = randi(4,1);
2727
% Exercise 4 code goes here
28-
switch newVertex
28+
switch NewVertex
2929
case 1
30-
newCoords = [0 0];
30+
NewCoords = [0 0];
3131
case 2
32-
newCoords = [0 1];
32+
NewCoords = [0 1];
3333
case 3
34-
newCoords = [1 1];
34+
NewCoords = [1 1];
3535
case 4
36-
newCoords = [1 0];
36+
NewCoords = [1 0];
3737
end
3838
% Update the new point using the formula from the rules of the game
39-
% This does simplify to (newCoords+startingPoint)/2 as used in the live
39+
% This does simplify to (NewCoords+StartingPoint)/2 as used in the live
4040
% script
41-
newPoint = (newCoords-startingPoint)/2 + startingPoint;
41+
NewPoint = (NewCoords-StartingPoint)/2 + StartingPoint;
4242

43-
s.XData(k) = newPoint(1);
44-
s.YData(k) = newPoint(2);
45-
startingPoint = newPoint;
46-
oldVertex = newVertex;
43+
s.XData(k) = NewPoint(1);
44+
s.YData(k) = NewPoint(2);
45+
StartingPoint = NewPoint;
46+
OldVertex = NewVertex;
4747
% Exercise 3 code goes here
4848
drawnow
4949
% Exercise 3 code goes here, too

HelperFunctions/OpenOverview.m

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)