diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9b005a945328161dc7fa6e5cb2325ab9de00f329 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# Repo for pratice and homework + +## Homework on GitLab + +This exercise has to be done on your lab computer on which `Matlab` **is** installed. Don't forget to properly configure `git` with your username and email, as we explained in the training slides. + +<br> +During the training, you committed to the +[https://git-r3lab.uni.lu/git-training/practice](https://git-r3lab.uni.lu/git-training/practice) +repository. + +<br> +Your task is to create a fork of this repository, commit some code and create a merge request on `GitLab`. + + +## Homework: instructions + +- First, fork the [https://git-r3lab.uni.lu/git-training/practice](https://git-r3lab.uni.lu/git-training/practice) repository. + +- Create the new branch `homework_myName`. + +- Implement a new function (create a new file `sqrt_myName.m`) called `sqrt_myName(x)` that computes the square root of `x`. + +- Copy the `test.m` file to `test_myName.m` and change the names of the functions accordingly. + + +- Before submitting the merge request, verify locally that your code is running properly. + Simply execute it + ```sh + $ matlab -nodesktop -nosplash < test_myName.m + ``` + and verify that no error is reported. + +- Create a merge-request. + +- Assign either Laurent (@laurent.heirendt) or Sylvain (@sylvain.arreckx) depending on your group and your merge-request will be reviewed by one of us. + +<br> +That's it! diff --git a/firstCommit/addTwoNumbers.m b/firstCommit/addTwoNumbers.m index 1283e79b7f6fbf46ddcae6c56a33bea35c22b4e8..a2bda847736a8944ab35d869dd7609df18ba5d17 100644 --- a/firstCommit/addTwoNumbers.m +++ b/firstCommit/addTwoNumbers.m @@ -1,5 +1,5 @@ -%% function addTwoNumbers(a, b) returns the sum of a and b - function c = addTwoNumbers(a, b) -% c = a + b +% addTwoNumbers(a, b) returns the sum of a and b + +% c = a + b; end diff --git a/secondCommit/multiplyTwoNumbers.m b/secondCommit/multiplyTwoNumbers.m index 2d01284013a30648903e3e88599b118466f3a91b..2431ab5ec29578b9efcc05cdeaea6c44154c7f8a 100644 --- a/secondCommit/multiplyTwoNumbers.m +++ b/secondCommit/multiplyTwoNumbers.m @@ -1,5 +1,5 @@ -%% function multiplyTwoNumbers(a, b) returns the product of a and b - function c = multiplyTwoNumbers(a, b) -% c = a * b +% multiplyTwoNumbers(a, b) returns the product of a and b + +% c = a * b; end diff --git a/test.m b/test.m new file mode 100644 index 0000000000000000000000000000000000000000..5d97387d8dc88a88a87fd8acf3616cc64ff555af --- /dev/null +++ b/test.m @@ -0,0 +1,10 @@ +% Test file + +addpath(genpath(pwd)) % add this folder and all subfolders to the path + +c = addTwoNumbers_myName(1, 1); % 1 + 1 + +d = multiplyTwoNumbers_myName(c, c); % 2 * 2 + +% test my sqrt function +assert(sqrt_myName(d) == sqrt(d))