I am working on a project in C++ and I've never used blitz++

#include <blitz/array.h>

What I have:

a multi array X, which is a 3XD complex array * #encode * # frames

Array< Array<complex<float>,3>,2 > X = recon.read_data(data);

What I wrote (not working) -> I want to export every encode associated with same frame

int encodeN = X.length(secondDim); 
int frameN = X.length(firstDim);

for(int ee=0; ee< encodeN; ee++){
    for(int tt=0; tt< frameN; tt++){

        Array<float,3> Xr = real(X(tt,ee));
        Array<float,3> Xi = imag(X(tt,ee));

        Array< Array<float,3>,1 > Y; //Array for all encodes in same frame
        int encodeL = Xr.length(thirdDim)     //Size in z direction 

        for (int count=0; count< encodeL; count++){
            stringstream label;
            label << "Image " << count + ee * encodeL << "Frame " << tt + 1;
            Y(tt) = Xr(Range::all(), Range::all(),2 * count)
            Y(tt) = Xi(Range::all(), Range::all(),2 * count + 1)
for(int j=0; j< frameN; j++){
        recon.write_images( Y(j) , image.lx + j ,f.str(),max,Ymax_x,Ymax_y,Ymax_z;

What I want to do

First I need to split every encode (3D array) into real and imaginary. then I need to inter combine the imaginary and real slides along the z direction. For example, if my first encode is a 400x400x400 data set1, I need to end up with a 400x400x800 data set2. where the first to slice of set2 in equal to the real part of the first slice in set1 and second slice in set2 in equal to the imaginary part of the first slice in set1 (along z direction).

Onces done that, if I have 3 encodes in the first frame I should end up whit data set2 = 400x400x(800*3) = 400x400x2400. This set will be my first array in my new multi array matrix Y or Y(0).

The write_images function is expecting a Array<float,3> array to turn into images.

The Problem

For starters it won't compile. it says that the write_images function wants another format. Then, I am to sure if there is a way to modify the information with in the same X matrix (this would be ideal). I think the write_images function needs some other values associated with the already created array X. The compiler says: error: Y was not declared in this scope

Note: I couldn't fine anything similar to my problem not the documentation paper (Indexing, subarrays, and slicing ->in 4 or more dimensions p. 14).  I am aware of the label issue but this is not a priority, however any help with that will be appreciated as well.Thanks!!! 

 ∫θγgε  ιμεηεζ