Access a column of a matrix as a vector in Eigen

Aarohi Johal picture Aarohi Johal · Mar 1, 2012 · Viewed 20.1k times · Source

How can I access a single vector from a matrix?

For example: Is there a way to extract a vector using something like A(i) for a matrix Eigen::MatrixXf A(10,10) that returns an Eigen::VectorXf A(10)?

Answer

Aarohi Johal picture Aarohi Johal · Mar 1, 2012

Found in the documentation :/ The way to access a single column is .col(i), and similarly for row, its .row(i). Also of interest is .block<>.