function [Fluor     cellCycleFluor   normCCFluor  ...
    Fluor_2CC cellCycleFluor_2CC normCCFluor_2CC...
    Fluor_3CC cellCycleFluor_3CC normCCFluor_3CC...
    Fluor_4CC cellCycleFluor_4CC normCCFluor_4CC...
    ]= nature_generateMatrices(cell);

CCMaxLength =200;
analyzeAllMatrixTypes =0;

%initialize matrices
Fluor=[];
cellCycleFluor=[];
normCCFluor =[];

Fluor_2CC=[];
cellCycleFluor_2CC=[];
normCCFluor_2CC =[];

Fluor_3CC=[];
cellCycleFluor_3CC=[];
normCCFluor_3CC =[];

Fluor_4CC=[];
cellCycleFluor_4CC=[];
normCCFluor_4CC =[];


Fluor = NaN*zeros(length(cell),CCMaxLength);
for i=1:length(cell)
    Fluor(i,1:length(cell(i).Fluor)) = cell(i).Fluor;
end
cellCycleFluor=cell2mat({cell(:).CCFluor}');
normCCFluor=cell2mat({cell(:).NormCCFluor}');
counter_2CC = 0;
Fluor_2CC = NaN*zeros(length(cell)*2,CCMaxLength*2); %the un-synchronized fluor have different vector lengths!!!
counter_3CC = 0;
Fluor_3CC = NaN*zeros(length(cell)*3,CCMaxLength*3); %the un-synchronized fluor have different vector lengths!!!
counter_4CC = 0;
Fluor_4CC = NaN*zeros(length(cell)*4,CCMaxLength*4); %the un-synchronized fluor have different vector lengths!!!
for i=1:length(cell)
    daughter1 = cell(i).SmoothDaughter1;
    daughter2 = cell(i).SmoothDaughter2;
    if ~isempty(daughter1)
        counter_2CC = counter_2CC+1;
        vectLength = length(cell(i).Fluor) + length(cell(daughter1).Fluor);
        Fluor_2CC(counter_2CC,1:vectLength) = [cell(i).Fluor cell(daughter1).Fluor];
        cellCycleFluor_2CC(counter_2CC,:) = [cell(i).CCFluor cell(daughter1).CCFluor];
        normCCFluor_2CC(counter_2CC,:) = [cell(i).NormCCFluor cell(daughter1).NormCCFluor];

        grandDaughter00 = cell(daughter1).SmoothDaughter1;
        grandDaughter01 = cell(daughter1).SmoothDaughter2;
        if ~isempty(grandDaughter00)
            counter_3CC = counter_3CC+1;
            vectLength = length(cell(i).Fluor) + length(cell(daughter1).Fluor) + length(cell(grandDaughter00).Fluor);
            Fluor_3CC(counter_3CC,1:vectLength) = [cell(i).Fluor cell(daughter1).Fluor cell(grandDaughter00).Fluor];
            cellCycleFluor_3CC(counter_3CC,:) = [cell(i).CCFluor cell(daughter1).CCFluor cell(grandDaughter00).CCFluor];
            normCCFluor_3CC(counter_3CC,:) = [cell(i).NormCCFluor cell(daughter1).NormCCFluor cell(grandDaughter00).NormCCFluor];
            
            greatGrandDaughter000 = cell(grandDaughter00).SmoothDaughter1;
            greatGrandDaughter001 = cell(grandDaughter00).SmoothDaughter2;
            if ~isempty(greatGrandDaughter000)
                counter_4CC = counter_4CC+1;
                vectLength = length(cell(i).Fluor) + length(cell(daughter1).Fluor) + length(cell(grandDaughter00).Fluor) + length(cell(greatGrandDaughter000).Fluor);
                Fluor_4CC(counter_4CC,1:vectLength) = [cell(i).Fluor cell(daughter1).Fluor cell(grandDaughter00).Fluor cell(greatGrandDaughter000).Fluor];
                cellCycleFluor_4CC(counter_4CC,:) = [cell(i).CCFluor cell(daughter1).CCFluor cell(grandDaughter00).CCFluor cell(greatGrandDaughter000).CCFluor];
                normCCFluor_4CC(counter_4CC,:) = [cell(i).NormCCFluor cell(daughter1).NormCCFluor cell(grandDaughter00).NormCCFluor cell(greatGrandDaughter000).NormCCFluor];
            end
            if ~isempty(greatGrandDaughter001)
                counter_4CC = counter_4CC+1;
                vectLength = length(cell(i).Fluor) + length(cell(daughter1).Fluor) + length(cell(grandDaughter00).Fluor) + length(cell(greatGrandDaughter001).Fluor);
                Fluor_4CC(counter_4CC,1:vectLength) = [cell(i).Fluor cell(daughter1).Fluor cell(grandDaughter00).Fluor cell(greatGrandDaughter001).Fluor];
                cellCycleFluor_4CC(counter_4CC,:) = [cell(i).CCFluor cell(daughter1).CCFluor cell(grandDaughter00).CCFluor cell(greatGrandDaughter001).CCFluor];
                normCCFluor_4CC(counter_4CC,:) = [cell(i).NormCCFluor cell(daughter1).NormCCFluor cell(grandDaughter00).NormCCFluor cell(greatGrandDaughter001).NormCCFluor];
            end
        end
        if ~isempty(grandDaughter01)
            counter_3CC = counter_3CC+1;
            vectLength = length(cell(i).Fluor) + length(cell(daughter1).Fluor) + length(cell(grandDaughter01).Fluor);
            Fluor_3CC(counter_3CC,1:vectLength) = [cell(i).Fluor cell(daughter1).Fluor cell(grandDaughter01).Fluor];
            cellCycleFluor_3CC(counter_3CC,:) = [cell(i).CCFluor cell(daughter1).CCFluor cell(grandDaughter01).CCFluor];
            normCCFluor_3CC(counter_3CC,:) = [cell(i).NormCCFluor cell(daughter1).NormCCFluor cell(grandDaughter01).NormCCFluor];
            
            greatGrandDaughter010 = cell(grandDaughter01).SmoothDaughter1;
            greatGrandDaughter011 = cell(grandDaughter01).SmoothDaughter2;
            if ~isempty(greatGrandDaughter010)
                counter_4CC = counter_4CC+1;
                vectLength = length(cell(i).Fluor) + length(cell(daughter1).Fluor) + length(cell(grandDaughter01).Fluor) + length(cell(greatGrandDaughter010).Fluor);
                Fluor_4CC(counter_4CC,1:vectLength) = [cell(i).Fluor cell(daughter1).Fluor cell(grandDaughter01).Fluor cell(greatGrandDaughter010).Fluor];
                cellCycleFluor_4CC(counter_4CC,:) = [cell(i).CCFluor cell(daughter1).CCFluor cell(grandDaughter01).CCFluor cell(greatGrandDaughter010).CCFluor];
                normCCFluor_4CC(counter_4CC,:) = [cell(i).NormCCFluor cell(daughter1).NormCCFluor cell(grandDaughter01).NormCCFluor cell(greatGrandDaughter010).NormCCFluor];
            end
            if ~isempty(greatGrandDaughter011)
                counter_4CC = counter_4CC+1;
                vectLength = length(cell(i).Fluor) + length(cell(daughter1).Fluor) + length(cell(grandDaughter01).Fluor) + length(cell(greatGrandDaughter011).Fluor);
                Fluor_4CC(counter_4CC,1:vectLength) = [cell(i).Fluor cell(daughter1).Fluor cell(grandDaughter01).Fluor cell(greatGrandDaughter011).Fluor];
                cellCycleFluor_4CC(counter_4CC,:) = [cell(i).CCFluor cell(daughter1).CCFluor cell(grandDaughter01).CCFluor cell(greatGrandDaughter011).CCFluor];
                normCCFluor_4CC(counter_4CC,:) = [cell(i).NormCCFluor cell(daughter1).NormCCFluor cell(grandDaughter01).NormCCFluor cell(greatGrandDaughter011).NormCCFluor];
            end
        end
    end
    if ~isempty(daughter2)
        counter_2CC = counter_2CC+1;
        vectLength = length(cell(i).Fluor) + length(cell(daughter2).Fluor);
        Fluor_2CC(counter_2CC,1:vectLength) = [cell(i).Fluor cell(daughter2).Fluor];
        cellCycleFluor_2CC(counter_2CC,:) = [cell(i).CCFluor cell(daughter2).CCFluor];
        normCCFluor_2CC(counter_2CC,:) = [cell(i).NormCCFluor cell(daughter2).NormCCFluor];
        
        grandDaughter10 = cell(daughter2).SmoothDaughter1;
        grandDaughter11 = cell(daughter2).SmoothDaughter2;
        if ~isempty(grandDaughter10)
            counter_3CC = counter_3CC+1;
            vectLength = length(cell(i).Fluor) + length(cell(daughter2).Fluor) + length(cell(grandDaughter10).Fluor);
            Fluor_3CC(counter_3CC,1:vectLength) = [cell(i).Fluor cell(daughter2).Fluor cell(grandDaughter10).Fluor];
            cellCycleFluor_3CC(counter_3CC,:) = [cell(i).CCFluor cell(daughter2).CCFluor cell(grandDaughter10).CCFluor];
            normCCFluor_3CC(counter_3CC,:) = [cell(i).NormCCFluor cell(daughter2).NormCCFluor cell(grandDaughter10).NormCCFluor];
            
            
            greatGrandDaughter100 = cell(grandDaughter10).SmoothDaughter1;
            greatGrandDaughter101 = cell(grandDaughter10).SmoothDaughter2;
            if ~isempty(greatGrandDaughter100)
                counter_4CC = counter_4CC+1;
                vectLength = length(cell(i).Fluor) + length(cell(daughter2).Fluor) + length(cell(grandDaughter10).Fluor) + length(cell(greatGrandDaughter100).Fluor);
                Fluor_4CC(counter_4CC,1:vectLength) = [cell(i).Fluor cell(daughter2).Fluor cell(grandDaughter10).Fluor cell(greatGrandDaughter100).Fluor];
                cellCycleFluor_4CC(counter_4CC,:) = [cell(i).CCFluor cell(daughter2).CCFluor cell(grandDaughter10).CCFluor cell(greatGrandDaughter100).CCFluor];
                normCCFluor_4CC(counter_4CC,:) = [cell(i).NormCCFluor cell(daughter2).NormCCFluor cell(grandDaughter10).NormCCFluor cell(greatGrandDaughter100).NormCCFluor];
            end
            if ~isempty(greatGrandDaughter101)
                counter_4CC = counter_4CC+1;
                vectLength = length(cell(i).Fluor) + length(cell(daughter2).Fluor) + length(cell(grandDaughter10).Fluor) + length(cell(greatGrandDaughter101).Fluor);
                Fluor_4CC(counter_4CC,1:vectLength) = [cell(i).Fluor cell(daughter2).Fluor cell(grandDaughter10).Fluor cell(greatGrandDaughter101).Fluor];
                cellCycleFluor_4CC(counter_4CC,:) = [cell(i).CCFluor cell(daughter2).CCFluor cell(grandDaughter10).CCFluor cell(greatGrandDaughter101).CCFluor];
                normCCFluor_4CC(counter_4CC,:) = [cell(i).NormCCFluor cell(daughter2).NormCCFluor cell(grandDaughter10).NormCCFluor cell(greatGrandDaughter101).NormCCFluor];
            end
        end
        if ~isempty(grandDaughter11)
            counter_3CC = counter_3CC+1;
            vectLength = length(cell(i).Fluor) + length(cell(daughter2).Fluor) + length(cell(grandDaughter11).Fluor);
            Fluor_3CC(counter_3CC,1:vectLength) = [cell(i).Fluor cell(daughter2).Fluor cell(grandDaughter11).Fluor];
            cellCycleFluor_3CC(counter_3CC,:) = [cell(i).CCFluor cell(daughter2).CCFluor cell(grandDaughter11).CCFluor];
            normCCFluor_3CC(counter_3CC,:) = [cell(i).NormCCFluor cell(daughter2).NormCCFluor cell(grandDaughter11).NormCCFluor];

            greatGrandDaughter110 = cell(grandDaughter11).SmoothDaughter1;
            greatGrandDaughter111 = cell(grandDaughter11).SmoothDaughter2;
            if ~isempty(greatGrandDaughter110)
                counter_4CC = counter_4CC+1;
                vectLength = length(cell(i).Fluor) + length(cell(daughter2).Fluor) + length(cell(grandDaughter11).Fluor) + length(cell(greatGrandDaughter110).Fluor);
                Fluor_4CC(counter_4CC,1:vectLength) = [cell(i).Fluor cell(daughter2).Fluor cell(grandDaughter11).Fluor cell(greatGrandDaughter110).Fluor];
                cellCycleFluor_4CC(counter_4CC,:) = [cell(i).CCFluor cell(daughter2).CCFluor cell(grandDaughter11).CCFluor cell(greatGrandDaughter110).CCFluor];
                normCCFluor_4CC(counter_4CC,:) = [cell(i).NormCCFluor cell(daughter2).NormCCFluor cell(grandDaughter11).NormCCFluor cell(greatGrandDaughter110).NormCCFluor];
            end
            if ~isempty(greatGrandDaughter111)
                counter_4CC = counter_4CC+1;
                vectLength = length(cell(i).Fluor) + length(cell(daughter2).Fluor) + length(cell(grandDaughter11).Fluor) + length(cell(greatGrandDaughter111).Fluor);
                Fluor_4CC(counter_4CC,1:vectLength) = [cell(i).Fluor cell(daughter2).Fluor cell(grandDaughter11).Fluor cell(greatGrandDaughter111).Fluor];
                cellCycleFluor_4CC(counter_4CC,:) = [cell(i).CCFluor cell(daughter2).CCFluor cell(grandDaughter11).CCFluor cell(greatGrandDaughter111).CCFluor];
                normCCFluor_4CC(counter_4CC,:) = [cell(i).NormCCFluor cell(daughter2).NormCCFluor cell(grandDaughter11).NormCCFluor cell(greatGrandDaughter111).NormCCFluor];
            end
        end
    end
end
