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: panel_opticalflow.m
    path of file: ./repos/brainstorm3/toolbox/gui
    
    the code of the file until where you have to start completion: function varargout = panel_opticalflow( varargin )
% PANEL_OPTICALFLOW: 

% @=============================================================================
% This function is part of the Brainstorm software:
% https://neuroimage.usc.edu/brainstorm
% 
% Copyright (c) University of Southern California & McGill University
% This software is distributed under the terms of the GNU General Public License
% as published by the Free Softw
    
function validate_time(hText, ev, interval)
        % VALIDATE_TIME   Check if time asked for by user is legitimately in
        %                 interval for which flow is calculated, and correct
        %                 if necessary
        %
        % INPUTS:
        %   hText     - handle containing text element for verificatino
        %   event     - ~
        %   interval  - hText must be an element in interval
        
        chosen = str2double(get(hText, 'String'))/1000; % Get time
        if isnan(chosen) % NaN -> bad input -> go back to default
            if strcmp(get(hText,'Tag'), 'MovieStart')
                chosen = interval(1);
            elseif strcmp(get(hText,'Tag'), 'MovieEnd')
                chosen = interval(end