Search code examples
c++armadillo

Armadillo - delete rows in a cube


I'm using Armadillo C++ library for matrices.

I have a 3d matrix (Cube) of size [73 256 1000].

I would like to take only part of the rows of the cube, e.g. in matlab

A = A(3:66, :, :);

How can I do it with Armadillo? I haven't found anything in the API.

Thanks.


Solution

  • The functionality is listed in Armadillo's documentation, in the subcube views section. You can use span::all to indicate an entire range. to For example:

    cube A(100,50,10);
    A.randu();
    
    A = A(span(3,66), span::all, span::all);