Deleting a column from a matrix (and a row from a vector)
Posted: Mon May 06, 2013 5:54 am
Hi,
I am estimating G regressions and storing a scalar from each regression in a row vector and a computed data series (nobs x 1) in each column of a matrix. Upon completion, I have a (Gx1) row vector and a (nobs X G) matrix. Later in the program, I multiply the (matrix * row vector). No problem.
For a few iterations, the computed series cannot be calculated so the column that is placed in the matrix has NAs. Needless to say, the computation of the (matrix * row vector) fails when this happens.
Is there a way that I could: (a) check for NAs in the (nobs x G) matrix when all of the iterations are completed and (b) delete the corresponding columns in the matrix and rows in the row vector for which NAs appear?
Thanks for your help.
I am estimating G regressions and storing a scalar from each regression in a row vector and a computed data series (nobs x 1) in each column of a matrix. Upon completion, I have a (Gx1) row vector and a (nobs X G) matrix. Later in the program, I multiply the (matrix * row vector). No problem.
For a few iterations, the computed series cannot be calculated so the column that is placed in the matrix has NAs. Needless to say, the computation of the (matrix * row vector) fails when this happens.
Is there a way that I could: (a) check for NAs in the (nobs x G) matrix when all of the iterations are completed and (b) delete the corresponding columns in the matrix and rows in the row vector for which NAs appear?
Thanks for your help.