You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: tesseractsubdivision.m
    path of file: ./repos/libDirectional/lib/util
    
    the code of the file until where you have to start completion: % Gerhard Kurz, Florian Pfaff, Uwe D. Hanebeck,
% Discretization of SO(3) Using Recursive Tesseract Subdivision
% Proceedings of the 2017 IEEE International Conference on Multisensor Fusion and Integration for Intelligent Systems (MFI 2017)
% Daegu, Korea, N
    
function newCube = generateCube(a,b)
    %generate axis aligned cube with opposite corners a and b
    x = zeros(16,4); %corner candidates
    %try all combinations of min/max in each dimension
    %todo optimize performance
    for i=1:16
        for j=1:4
            if bitget(i,j) == 1
                x(i,j) = min(a(j),b(j));
            else
                x(i,j) = max(a(j),b(j));
            end