Clear or Delete matrix or array

Hello everyone,

I’m working on some models where I’ve utilized arrays of numbers and matrices. At certain points in the code, I’d like to clear or delete some of them as they are no longer needed, or I’d like to rebuild them from scratch. Is there any functionality that allows for this?

Currently, I’m using the resize function to address this issue, with statements like:

matrix A; A.resize(100,100);

A(2,2) = 1.;A(5,5) = 1.;A(35,49) = 2.;

A.resize(0,0); A.resize(100,100);

Thank you in advance.

I think, you can clear the matrix
like in

matrix A; A.resize(100,100);

A(2,2) = 1.;A(5,5) = 1.;A(35,49) = 2.;
cout << " A = " << A << endl; 
A.clear; 
cout << " A = " << A << endl;