Reputation: 29
I have following Matlab code:
A = rand(4); % just for an example
B = A(1:3,1:2);
Thus B will be a 3x2 matrix and will contain elements of A starting from first row to third row and first column to second column. I could certainly do this in C++ with a for loop, but is there an easier way (like Matlab) to do this?
Upvotes: 0
Views: 127
Reputation: 1105
You are looking for something like the Armadillo library
Check here the conversion table between Matlab/Octave and C++
Upvotes: 2
Reputation: 81
I suggest Eigen for working with matrixes http://eigen.tuxfamily.org/index.php?title=Main_Page.
Upvotes: -1