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: falsecolor_demo_gui.m
    path of file: ./repos/mexopencv/samples
    
    the code of the file until where you have to start completion: %% Colormap Demo
%
% Sample shows how to apply false color on a grayscale image.
%
% Sources
    
function onChange(~,~,h)
    %ONCHANGE  Event handler for UI controls

    % apply colormap
    cmaps = get(h.pop, 'String');
    idx = get(h.pop, 'Value');
    if strcmp(cmaps{idx}, 'Gray')
        out = cv.cvtColor(h.gray, 'GRAY2RGB');
    elseif strcmp(cmaps{idx}, 'Random')
        out = cv.applyColorMap(h.gray, h.user);
    else
        out = cv.applyColorMap(h.gray, cmaps{idx});
    end