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: xyz2rgb.m
    path of file: ./repos/Image-Harmonization-Dataset-iHarmony4/Lalonde and Efros/utils/mycode/color
    
    the code of the file until where you have to start completion: function [R,G,B] = xyz2rgb(X,Y,Z)
% Converts XYZ to RGB data.
%
%   rgb = xyz2rgb(xyz)
% 
% Converts between images.
%
%   [r, g, b] = xyz2rgb(x, y, z)
%
% Converts between individual channels.
%
% See http://en.wikipedia.org/wiki/CIE_1931_Color_Space
%
% ----------
% Jean-Francois Lalonde

    
function [R,G,B] = xyz2rgb(X,Y,Z)
% Converts XYZ to RGB data.
%
%   rgb = xyz2rgb(xyz)
% 
% Converts between images.
%
%   [r, g, b] = xyz2rgb(x, y, z)
%
% Converts between individual channels.
%
% See http://en.wikipedia.org/wiki/CIE_1931_Color_Space
%
% ----------
% Jean-Francois Lalonde

if (nargin == 1)
    Z = X(:,:,3);
    Y = X(:,:,2);
    X = X(:,:,1);
end