Code covered by the BSD License  

Highlights from
Date Odometer class

image thumbnail

Date Odometer class

by

 

12 Apr 2011 (Updated )

Add an odometer-like object to a plot to show the progression of time.

date_odometer
classdef date_odometer < handle
% classdef date_odometer < handle
%
% handle = date_odometer(figure_handle, datetime, position)

% "date_odometer" objects contain odometer digits for month, day and year.

% Kevin J. Delaney, BMT Scientific Marine Services
% April 13 2011

properties (Access = private, Transient = true)
    all_object_handles          % Cell array of handles actually in use, 
                                %  in left-to-right order
    dashbox_1_handle            % Image with separator.
    dashbox_2_handle            % Image with separator.
    datetime                    % Date/time in datenum format
    daybox_10_handle            % Image for day digits
    daybox_1_handle             % Image for day digits
    handles_being_incremented   % Cell array of handles being incremented.
    monthbox_handle             % Image for month text
    monthbox_10_handle          % Image for month digits
    monthbox_1_handle           % Image for month digits
    parent                      % Figure object
    position                    % Vector [x, y, width, height] in normalized units
    step_fraction               % Typically 1, but can be a fraction for animation
                                %  Example: setting = 0.25 rolls the odometer
                                %  one quarter of the way
    special_month_increment     % Boolean: true for numeric month styles
    style                       % String like 'mmm-dd-yyyy'
	total_rotation_fraction     % Used to keep track of when enough partial
                                %  rotations have been accomplished.
    yearbox_1000_handle         % Image for year digits
    yearbox_100_handle          % Image for year digits
    yearbox_10_handle           % Image for year digits
    yearbox_1_handle            % Image for year digits
end

methods
    %
    %   OBJECT CONSTRUCTOR
    %
    function handle = date_odometer(varargin)
        % handle = date_odometer(figure_handle, datetime, position, style)
        %
        % Instantiates a 'date_odometer' object.
        %
        % Inputs:
        %   figure_handle   Parent object
        %   datetime        Initial value
        %   position        Position vector in normalized units
        %   style           Optional text like 'dd-mm-yyyy'
        %                       Default: 'mmm-dd-yyyy'
        
        switch nargin

            case 3
                handle.style = 'mmm-dd-yyyy';
                
            case 4
                handle.style = varargin{4};

            otherwise
                errordlg(['Unexpected number of inputs in "date_odometer" constructor: ', ...
                    num2str(nargin)], mfilename);
                return
        end
        
        handle.parent   = varargin{1};
        handle.datetime = varargin{2};
        handle.position = varargin{3};

        odometer_width  = handle.position(3);
        odometer_height = handle.position(4);
        digit_height = 0.95 * odometer_height;

        %   Create axes to hold the digits.
        figure_color = get(handle.parent, 'Color');
        axes_handle = axes('Units', 'normalized', ...
                           'Color', figure_color, ...
                           'HandleVisibility', 'off', ...
                           'Parent', handle.parent, ...
                           'Position', handle.position, ...
                           'XColor', figure_color, ...
                           'YColor', figure_color);

        %   Break initial date into components.
        [year_value, month_value, day_value] = datevec(handle.datetime);
        handle.special_month_increment = false;
        
        switch lower(handle.style)
            
            case 'mmm dd yyyy'
                digit_width = odometer_width / 11;

                %   The month text.
                position_vector = [0, 0, 3 * digit_width, digit_height];
                handle.monthbox_handle = odometer_text(axes_handle, position_vector, ...
                                                       {'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', ...
                                                        'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'}, month_value);
                set(axes_handle, 'XLim', [0, odometer_width], 'YLim', [0, odometer_height]);

                %   Blank between month & day.
                handle.dashbox_1_handle = odometer_text(axes_handle, [3 * digit_width, 0, digit_width, digit_height], {'blank'}, 1);

                %   The day digits.
                [tens_digit, ones_digit] = break_into_digits(day_value, 2);
                position_vector = [4 * digit_width, 0, digit_width, digit_height];
                handle.daybox_10_handle = odometer_text(axes_handle, position_vector, ...
                                                        {'1', '2', '3', '0'}, tens_digit);
                position_vector = [5 * digit_width, 0, digit_width, digit_height];
                handle.daybox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);

                %   Dash between day & year.
                handle.dashbox_2_handle = odometer_text(axes_handle, [6 * digit_width, 0, digit_width, digit_height], {'blank'}, 1);
                
                %   The year digits.
                [thousands_digit, hundreds_digit, tens_digit, ones_digit] = break_into_digits(year_value, 4);
                position_vector = [7 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1000_handle = odometer_digit(axes_handle, position_vector, thousands_digit);
                position_vector = [8 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_100_handle = odometer_digit(axes_handle, position_vector, hundreds_digit);
                position_vector = [9 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_10_handle = odometer_digit(axes_handle, position_vector, tens_digit);
                position_vector = [10 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);
                
                handle.all_object_handles = {handle.monthbox_handle; ...
                                             handle.daybox_10_handle; ...
                                             handle.daybox_1_handle; ...
                                             handle.yearbox_1000_handle; ...
                                             handle.yearbox_100_handle; ...
                                             handle.yearbox_10_handle; ...
                                             handle.yearbox_1_handle};
            
            case 'mmm-dd-yyyy'
                digit_width = odometer_width / 11;

                %   The month text.
                position_vector = [0, 0, 3 * digit_width, digit_height];
                handle.monthbox_handle = odometer_text(axes_handle, position_vector, ...
                                                       {'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', ...
                                                        'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'}, month_value);
                set(axes_handle, 'XLim', [0, odometer_width], 'YLim', [0, odometer_height]);

                %   Dash between month & day.
                handle.dashbox_1_handle = odometer_text(axes_handle, [3 * digit_width, 0, digit_width, digit_height], {'dash'}, 1);

                %   The day digits.
                [tens_digit, ones_digit] = break_into_digits(day_value, 2);
                position_vector = [4 * digit_width, 0, digit_width, digit_height];
                handle.daybox_10_handle = odometer_text(axes_handle, position_vector, ...
                                                        {'1', '2', '3', '0'}, tens_digit);
                position_vector = [5 * digit_width, 0, digit_width, digit_height];
                handle.daybox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);

                %   Dash between day & year.
                handle.dashbox_2_handle = odometer_text(axes_handle, [6 * digit_width, 0, digit_width, digit_height], {'dash'}, 1);

                %   The year digits.
                [thousands_digit, hundreds_digit, tens_digit, ones_digit] = break_into_digits(year_value, 4);
                position_vector = [7 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1000_handle = odometer_digit(axes_handle, position_vector, thousands_digit);
                position_vector = [8 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_100_handle = odometer_digit(axes_handle, position_vector, hundreds_digit);
                position_vector = [9 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_10_handle = odometer_digit(axes_handle, position_vector, tens_digit);
                position_vector = [10 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);
                
                handle.all_object_handles = {handle.monthbox_handle; ...
                                             handle.daybox_10_handle; ...
                                             handle.daybox_1_handle; ...
                                             handle.yearbox_1000_handle; ...
                                             handle.yearbox_100_handle; ...
                                             handle.yearbox_10_handle; ...
                                             handle.yearbox_1_handle};

            case 'mmm/dd/yyyy'
                digit_width = odometer_width / 11;

                %   The month text.
                position_vector = [0, 0, 3 * digit_width, digit_height];
                handle.monthbox_handle = odometer_text(axes_handle, position_vector, ...
                                                       {'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', ...
                                                        'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'}, month_value);
                set(axes_handle, 'XLim', [0, odometer_width], 'YLim', [0, odometer_height]);

                %   Dash between month & day.
                handle.dashbox_1_handle = odometer_text(axes_handle, [3 * digit_width, 0, digit_width, digit_height], {'slash'}, 1);

                %   The day digits.
                [tens_digit, ones_digit] = break_into_digits(day_value, 2);
                position_vector = [4 * digit_width, 0, digit_width, digit_height];
                handle.daybox_10_handle = odometer_text(axes_handle, position_vector, ...
                                                        {'1', '2', '3', '0'}, tens_digit);
                position_vector = [5 * digit_width, 0, digit_width, digit_height];
                handle.daybox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);

                %   Dash between day & year.
                handle.dashbox_2_handle = odometer_text(axes_handle, [6 * digit_width, 0, digit_width, digit_height], {'slash'}, 1);

                %   The year digits.
                [thousands_digit, hundreds_digit, tens_digit, ones_digit] = break_into_digits(year_value, 4);
                position_vector = [7 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1000_handle = odometer_digit(axes_handle, position_vector, thousands_digit);
                position_vector = [8 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_100_handle = odometer_digit(axes_handle, position_vector, hundreds_digit);
                position_vector = [9 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_10_handle = odometer_digit(axes_handle, position_vector, tens_digit);
                position_vector = [10 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);
                
                handle.all_object_handles = {handle.monthbox_handle; ...
                                             handle.daybox_10_handle; ...
                                             handle.daybox_1_handle; ...
                                             handle.yearbox_1000_handle; ...
                                             handle.yearbox_100_handle; ...
                                             handle.yearbox_10_handle; ...
                                             handle.yearbox_1_handle};

            case 'dd mm yyyy'
                
                digit_width = odometer_width / 10;

                %   The day digits.
                [tens_digit, ones_digit] = break_into_digits(day_value, 2);
                position_vector = [0 * digit_width, 0, digit_width, digit_height];
                handle.daybox_10_handle = odometer_text(axes_handle, position_vector, ...
                                                        {'1', '2', '3', '0'}, tens_digit);
                set(axes_handle, 'XLim', [0, odometer_width], 'YLim', [0, odometer_height]);
                position_vector = [1 * digit_width, 0, digit_width, digit_height];
                handle.daybox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);

                %   Dash between day & month.
                handle.dashbox_1_handle = odometer_text(axes_handle, [2 * digit_width, 0, digit_width, digit_height], {'blank'}, 1);

                %   The month digits.
                [tens_digit, ones_digit] = break_into_digits(month_value, 2);
                position_vector = [3 * digit_width, 0, digit_width, digit_height];
                handle.monthbox_10_handle = odometer_text(axes_handle, position_vector, ...
                                                          {'1', '0'}, tens_digit);
                position_vector = [4 * digit_width, 0, digit_width, digit_height];
                handle.monthbox_1_handle  = odometer_text(axes_handle, position_vector, ...
                                                          {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}, ...
                                                          ones_digit);

                %   Dash between month & year.
                handle.dashbox_2_handle = odometer_text(axes_handle, [5 * digit_width, 0, digit_width, digit_height], {'blank'}, 1);

                %   The year digits.
                [thousands_digit, hundreds_digit, tens_digit, ones_digit] = break_into_digits(year_value, 4);
                position_vector = [6 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1000_handle = odometer_digit(axes_handle, position_vector, thousands_digit);
                position_vector = [7 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_100_handle = odometer_digit(axes_handle, position_vector, hundreds_digit);
                position_vector = [8 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_10_handle = odometer_digit(axes_handle, position_vector, tens_digit);
                position_vector = [9 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);
                
                handle.all_object_handles = {handle.daybox_10_handle; ...
                                             handle.daybox_1_handle; ...
                                             handle.monthbox_10_handle; ...
                                             handle.monthbox_1_handle; ...
                                             handle.yearbox_1000_handle; ...
                                             handle.yearbox_100_handle; ...
                                             handle.yearbox_10_handle; ...
                                             handle.yearbox_1_handle};
                handle.special_month_increment = true;


            case 'dd-mm-yyyy'
                
                digit_width = odometer_width / 10;

                %   The day digits.
                [tens_digit, ones_digit] = break_into_digits(day_value, 2);
                position_vector = [0 * digit_width, 0, digit_width, digit_height];
                handle.daybox_10_handle = odometer_text(axes_handle, position_vector, ...
                                                        {'1', '2', '3', '0'}, tens_digit);
                set(axes_handle, 'XLim', [0, odometer_width], 'YLim', [0, odometer_height]);
                position_vector = [1 * digit_width, 0, digit_width, digit_height];
                handle.daybox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);

                %   Dash between day & month.
                handle.dashbox_1_handle = odometer_text(axes_handle, [2 * digit_width, 0, digit_width, digit_height], {'dash'}, 1);

                %   The month digits.
                [tens_digit, ones_digit] = break_into_digits(month_value, 2);
                position_vector = [3 * digit_width, 0, digit_width, digit_height];
                handle.monthbox_10_handle = odometer_text(axes_handle, position_vector, ...
                                                          {'1', '0'}, tens_digit);
                position_vector = [4 * digit_width, 0, digit_width, digit_height];
                handle.monthbox_1_handle  = odometer_text(axes_handle, position_vector, ...
                                                          {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}, ...
                                                          ones_digit);

                %   Dash between month & year.
                handle.dashbox_2_handle = odometer_text(axes_handle, [5 * digit_width, 0, digit_width, digit_height], {'dash'}, 1);

                %   The year digits.
                [thousands_digit, hundreds_digit, tens_digit, ones_digit] = break_into_digits(year_value, 4);
                position_vector = [6 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1000_handle = odometer_digit(axes_handle, position_vector, thousands_digit);
                position_vector = [7 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_100_handle = odometer_digit(axes_handle, position_vector, hundreds_digit);
                position_vector = [8 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_10_handle = odometer_digit(axes_handle, position_vector, tens_digit);
                position_vector = [9 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);
                
                handle.all_object_handles = {handle.daybox_10_handle; ...
                                             handle.daybox_1_handle; ...
                                             handle.monthbox_10_handle; ...
                                             handle.monthbox_1_handle; ...
                                             handle.yearbox_1000_handle; ...
                                             handle.yearbox_100_handle; ...
                                             handle.yearbox_10_handle; ...
                                             handle.yearbox_1_handle};
                handle.special_month_increment = true;

            case 'dd/mm/yyyy'
                
                digit_width = odometer_width / 10;

                %   The day digits.
                [tens_digit, ones_digit] = break_into_digits(day_value, 2);
                position_vector = [0 * digit_width, 0, digit_width, digit_height];
                handle.daybox_10_handle = odometer_text(axes_handle, position_vector, ...
                                                        {'1', '2', '3', '0'}, tens_digit);
                set(axes_handle, 'XLim', [0, odometer_width], 'YLim', [0, odometer_height]);
                position_vector = [1 * digit_width, 0, digit_width, digit_height];
                handle.daybox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);

                %   Dash between day & month.
                handle.dashbox_1_handle = odometer_text(axes_handle, [2 * digit_width, 0, digit_width, digit_height], {'slash'}, 1);

                %   The month digits.
                [tens_digit, ones_digit] = break_into_digits(month_value, 2);
                position_vector = [3 * digit_width, 0, digit_width, digit_height];
                handle.monthbox_10_handle = odometer_text(axes_handle, position_vector, ...
                                                          {'1', '0'}, tens_digit);
                position_vector = [4 * digit_width, 0, digit_width, digit_height];
                handle.monthbox_1_handle  = odometer_text(axes_handle, position_vector, ...
                                                          {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}, ...
                                                          ones_digit);

                %   Dash between month & year.
                handle.dashbox_2_handle = odometer_text(axes_handle, [5 * digit_width, 0, digit_width, digit_height], {'slash'}, 1);
                %   The year digits.
                [thousands_digit, hundreds_digit, tens_digit, ones_digit] = break_into_digits(year_value, 4);
                position_vector = [6 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1000_handle = odometer_digit(axes_handle, position_vector, thousands_digit);
                position_vector = [7 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_100_handle = odometer_digit(axes_handle, position_vector, hundreds_digit);
                position_vector = [8 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_10_handle = odometer_digit(axes_handle, position_vector, tens_digit);
                position_vector = [9 * digit_width, 0, digit_width, digit_height];
                handle.yearbox_1_handle = odometer_digit(axes_handle, position_vector, ones_digit);
                
                handle.all_object_handles = {handle.daybox_10_handle; ...
                                             handle.daybox_1_handle; ...
                                             handle.monthbox_10_handle; ...
                                             handle.monthbox_1_handle; ...
                                             handle.yearbox_1000_handle; ...
                                             handle.yearbox_100_handle; ...
                                             handle.yearbox_10_handle; ...
                                             handle.yearbox_1_handle};
                handle.special_month_increment = true;

            otherwise
                errordlg(['Unknown "style": "', handle.style, '".'], ...
                    mfilename);
                return
        end
        %   Defaults
        handle.handles_being_incremented = {};
        handle.step_fraction = 0.25;
        handle.total_rotation_fraction = 0;
        
        %   Check to see if special increment instructions are needed.
        if handle.special_month_increment
            if month_value == 1
                % Then it's January--and if we DECREMENT from here the
                % month's least-significant-digit (LSD) will go from 1 to
                % 2, not to 0 as expected.
                handle.monthbox_1_handle.set_previous_text(2);
            elseif month_value == 12
                % Then it's December--and if we INCREMENT from here the
                % month's least-significant-digit (LSD) will go from 2 to
                % 1, not to 3 as expected.
                handle.monthbox_1_handle.set_next_text(1);
            end                
        end
           
    end %object constructor
    
    function set.datetime(obj, datetime)
        if isempty(datetime) || isdatenum(datetime)
            obj.datetime = datetime;
        else
            errordlg('Input "datetime" is not valid datenum".', mfilename);
            return
        end
    end
                
    function set.position(obj, position_vector)
        if isempty(position_vector) || ...
           (isnumeric(position_vector) && length(position_vector) == 4)
            obj.position = position_vector;
        else
            errordlg('Input "position_vector" is not a [1 X 4] numeric vector.', ...
                mfilename);
            return
        end
    end
%         
%     function set.style(obj, style_string)
%         if isempty(style_string) || ischar(style_string)
%             
%             switch lower(style_string)
%                 case {'mmm-dd-yyyy', 'dd-mm-yyyy'}
%                 otherwise
%                     errordlg(['Unknown "style": "', style_string, '".'], ...
%                         mfilename);
%                     return
%             end
%             
%             obj.style = style_string;
%         else
%             errordlg('Input "style_string" is not valid style string".', mfilename);
%             return
%         end
%     end
                
    function datetime = get.datetime(obj)
        datetime = obj.datetime;
    end
        
    function handles = get.monthbox_handle(obj)
        handles = obj.monthbox_handle;
    end
        
    function handles = get.monthbox_10_handle(obj)
        handles = obj.monthbox_10_handle;
    end
        
    function handles = get.monthbox_1_handle(obj)
        handles = obj.monthbox_1_handle;
    end

    function handles = get.daybox_10_handle(obj)
        handles = obj.daybox_10_handle;
    end
        
    function handles = get.daybox_1_handle(obj)
        handles = obj.daybox_1_handle;
    end

    function handles = get.yearbox_1000_handle(obj)
        handles = obj.yearbox_1000_handle;
    end

    function handles = get.yearbox_100_handle(obj)
        handles = obj.yearbox_100_handle;
    end

    function handles = get.yearbox_10_handle(obj)
        handles = obj.yearbox_10_handle;
    end

    function handles = get.yearbox_1_handle(obj)
        handles = obj.yearbox_1_handle;
    end
        
    function set.parent(obj, parent_figure)
        if isempty(parent_figure) || ...
           (ishandle(parent_figure) && strcmpi(get(parent_figure, 'Type'), 'figure'))
            obj.parent = parent_figure;
        else
            errordlg('Input "parent_figure" is not a "figure" object.', ...
                mfilename);
            return
        end
    end
        
    function increment(obj, step_fraction)

        %   Default: Animate in four steps.
        if ~exist('step_fraction', 'var') || isempty(step_fraction) || ~isnumeric(step_fraction)
            step_fraction = 0.25;
            num_steps     = 4;
        else
            if (step_fraction < -1) || (step_fraction > 1)
                errordlg(['Invalid step size: ', num2str(step_fraction), '.'], ...
                    mfilename);
                return
            end

            %   Make sure it all results in exactly one whole rotation.
            total_num_steps = round(1 / abs(step_fraction));
            step_fraction = sign(step_fraction) / total_num_steps;
            obj.step_fraction = step_fraction;

            %   Perform ONE step, then return to calling routine.
            num_steps = 1;
        end
        
        if isempty(obj.handles_being_incremented)
            %   Then what handles will be affected by this change?
            digits_changed = which_digits_change(obj.datetime, obj.datetime + (1 * sign(step_fraction)), obj.style);
            obj.handles_being_incremented = obj.all_object_handles(digits_changed);
        end

        for step_num = 1:num_steps
            cellfun(@(x) x.increment(step_fraction), obj.handles_being_incremented);
            pause(0.2);
            
            %   Remember how far we've rotated.
            obj.total_rotation_fraction = obj.total_rotation_fraction + step_fraction;
        end
        
        %   Are we done?
        if abs(obj.total_rotation_fraction) >= 1
            obj.datetime = obj.datetime + (1 * sign(obj.total_rotation_fraction));
            obj.handles_being_incremented = [];
            obj.total_rotation_fraction = 0;
                    
            %   Check to see if special increment instructions are needed.
            if obj.special_month_increment
                [~, month_value] = datevec(obj.datetime);
                
                if month_value == 1
                    % Then it's January--and if we DECREMENT from here the
                    % month's least-significant-digit (LSD) will go from 1 to
                    % 2, not to 0 as expected.
                    obj.monthbox_1_handle.set_previous_text(2);
                elseif month_value == 12
                    % Then it's December--and if we INCREMENT from here the
                    % month's least-significant-digit (LSD) will go from 2 to
                    % 1, not to 3 as expected.
                    obj.monthbox_1_handle.set_next_text(1);
                end                
            end
        end
    end
    
    function delete(obj)
        
        if ishandle(obj.dashbox_1_handle)
            delete(obj.dashbox_1_handle);
        end

        if ishandle(obj.dashbox_2_handle)
            delete(obj.dashbox_2_handle);
        end

        if ishandle(obj.daybox_10_handle)
            delete(obj.daybox_10_handle);
        end
        
        if ishandle(obj.daybox_1_handle)
            delete(obj.daybox_1_handle);
        end
        
        if ishandle(obj.monthbox_handle)
            delete(obj.monthbox_handle);
        end
        
        if ishandle(obj.monthbox_10_handle)
            delete(obj.monthbox_10_handle);
        end
        
        if ishandle(obj.monthbox_1_handle)
            delete(obj.monthbox_1_handle);
        end

        if ishandle(obj.yearbox_1000_handle)
            delete(obj.yearbox_1000_handle);
        end
        
        if ishandle(obj.yearbox_100_handle)
            delete(obj.yearbox_100_handle);
        end
        
        if ishandle(obj.yearbox_10_handle)
            delete(obj.yearbox_10_handle);
        end
        
        if ishandle(obj.yearbox_1_handle)
            delete(obj.yearbox_1_handle);
        end
    end
end

end %classdef

Contact us