If you do this, then I imagine freeing the matrix would be different as well:Code://Allocate the actual data int* rawData = new int[rows*cols]; //Allocate pointers to the data int** data = new int*[rows]; //Point the pointers into the data for (int i=0; i < rows; ++i){ data[i] = &rawData[cols*i];
Rather simpler I say, if it works.Code:delete[] rawData; or delete[] data[0];
**EDIT**
[edit2: snip]Oops, I thought MATLAB was a library [/edit2]