Yo Fleyt / Mbed 2 deprecated roboticLab_withclass_3_July

Dependencies:   ISR_Mini-explorer mbed

Fork of roboticLab_withclass_3_July by Georgios Tsamis

Revision:
9:1cc27f33d3e1
Parent:
8:072a76960e27
Child:
10:d0109d7cbe7c
--- a/myMatrix.cpp	Mon Jul 10 12:49:07 2017 +0000
+++ b/myMatrix.cpp	Mon Jul 10 16:23:52 2017 +0000
@@ -3,7 +3,7 @@
 using namespace std;
 
 myMatrix::myMatrix(int inNbRow,int inNbColumn){
-    int i,j;
+    int i;
     this->nbRow=inNbRow;
     this->nbColumn=inNbColumn;
     //initialise data
@@ -14,16 +14,26 @@
         this->data[i] = new float[this->nbRow];
 
     //fill with 0
+    this->fillWithZeroes();
+}
 
-    for(i = 0; i < this->nbColumn; ++i) {
-        for(j = 0; j < this->nbRow; ++j) {
+void myMatrix::fillWithZeroes(){
+    for(int i = 0; i < this->nbColumn; ++i) {
+        for(int j = 0; j < this->nbRow; ++j) {
             this->data[i][j] = 0;
         }
     }
-
 }
 
 
+void myMatrix::fillByCopy(myMatrix mat1){
+    for(int i = 0; i < mat1.nbRow; ++i) {
+        for(int j = 0; j < mat1.nbColumn; ++j) {
+            this->data[i][j] = mat1.data[i][j];
+        }
+    }
+}
+
 //assume the dimensions are correct
 void myMatrix::fillWithTranspose(myMatrix mat1){
     for(int i = 0; i < mat1.nbRow; ++i) {