title: Armadillo: convert cube subview (tube) to vector
body: <p>I get compilation error when I try to get a vector/double from armadillo cube (using tube or slice). How to get from cube to (row)vec? I can not find an elegant cast/transform armadillo function.</p>
  
  <pre><code>#include &lt;RcppArmadillo.h&gt;
  //#include &lt;Rcpp.h&gt;
  using namespace Rcpp;
  
  // [[Rcpp::export]]
  void testarma() {
    arma::mat B;
  
    B &lt;&lt; 0.555950 &lt;&lt; 0.274690 &lt;&lt; 0.540605 &lt;&lt; 0.798938 &lt;&lt; arma::endr
      &lt;&lt; 0.108929 &lt;&lt; 0.830123 &lt;&lt; 0.891726 &lt;&lt; 0.895283 &lt;&lt; arma::endr
      &lt;&lt; 0.948014 &lt;&lt; 0.973234 &lt;&lt; 0.216504 &lt;&lt; 0.883152 &lt;&lt; arma::endr
      &lt;&lt; 0.023787 &lt;&lt; 0.675382 &lt;&lt; 0.231751 &lt;&lt; 0.450332 &lt;&lt; arma::endr;
  
    B.print("B:");
  
    // cubes ("3D matrices")
    arma::cube Q(B.n_rows, B.n_cols, 4);
  
    Q.slice(0) = B;
    Q.slice(1) = 2.0 * B;
    Q.slice(2) = 3.0 * B;
    Q.slice(3) = 4.0 * B;
  
    Q.print("Q:");
  
    Rcpp::Rcout &lt;&lt; "Q.tube(0, 1): " &lt;&lt; std::endl &lt;&lt; Q.tube(0, 1) &lt;&lt; std::endl;
  
    arma::rowvec whatIwant = arma::rowvec(4).fill(0.0);
  
    for (int i = 0; i &lt; 4; i++) {
      // This gives an error. cannot convert 'arma::subview_col&lt;double&gt;' to 'double' in assignment
      //whatIwant[i] = Q.slice(i).row(0).col(1);
      Rcpp::Rcout &lt;&lt; "At slice i=" &lt;&lt; i &lt;&lt; " value=" &lt;&lt; Q.slice(i).row(0).col(1) &lt;&lt; std::endl;
    }
  
    // But I don't want to write for loop. I am sure there exists
    // an "armadillo" way (function) that does exactly this
    // How to convert output of tube to rowvec?
  }
  </code></pre>