test morning
Dependencies: ISR_Mini-explorer mbed
Fork of roboticLab_withclass_3_July by
Diff: myMatrix.cpp
- Revision:
- 10:d0109d7cbe7c
- Parent:
- 9:1cc27f33d3e1
- Child:
- 11:b91fe0ed4fed
--- a/myMatrix.cpp Mon Jul 10 16:23:52 2017 +0000 +++ b/myMatrix.cpp Mon Jul 10 18:03:19 2017 +0000 @@ -9,22 +9,29 @@ //initialise data //memory - this->data= new float*[this->nbColumn]; - for(i = 0; i < this->nbColumn; ++i) - this->data[i] = new float[this->nbRow]; + this->data= new float*[this->nbRow]; + for(i = 0; i < this->nbRow; ++i) + this->data[i] = new float[this->nbColumn]; //fill with 0 this->fillWithZeroes(); } void myMatrix::fillWithZeroes(){ - for(int i = 0; i < this->nbColumn; ++i) { - for(int j = 0; j < this->nbRow; ++j) { + for(int i = 0; i < this->nbRow; ++i) { + for(int j = 0; j < this->nbColumn; ++j) { this->data[i][j] = 0; } } } +void myMatrix::set(int i,int j, float value){ + this->data[i][j]=value; +} + +float myMatrix::get(int i,int j){ + return this->data[i][j]; +} void myMatrix::fillByCopy(myMatrix mat1){ for(int i = 0; i < mat1.nbRow; ++i) {