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: quat2cube.m
    path of file: ./repos/mtex/geometry/@homochoricSO3Grid/private
    
    the code of the file until where you have to start completion: function XYZ = quat2cube(q)
%
% transforms unit quaternions (representing rotations) into cubochoric
%   representation 
% the transformation is achieved by going from representation as unit

    
function XYZ = quat2cube(q)
%
% transforms unit quaternions (representing rotations) into cubochoric
%   representation 
% the transformation is achieved by going from representation as unit
%   quaternions to homochoric representation (Lambert) and then further to
%   cubochoric representation (ball2cube)
% 
% Input
%  q - @quaternion
%
% Output
%  XYZ - cubochoric coordinates

xyz = Lambert([q.a(:) q.b(:) q.c(:) q.d(:)]);
XYZ = ball2cube(xyz);

end