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: joystickCalibrate.m
    path of file: ./repos/LADAC/control/joystick
    
    the code of the file until where you have to start completion: function joystickCalibrate( joystickname )
% joystickCalibrate detects the required configuration parameters of your
%   joy
    
function stickIdx = setStickIdx( stickIdx, idx )
        % Set the stick index and throw and error if the same stick should
        % have been moved in different directions but a second stick was
        % moved instead (index ambiguous).
        if stickIdx == 0 || stickIdx == idx
            stickIdx = idx;
        else
            error('Different sticks were detected for one stick up/down or left/right.');
        end