function   x = sviplot4(input)
%This function is only used by sviterbi.c 
% 
% See also SVIPLOT1, SVIPLOT2, SVIPLOT3

%  Copyright 1996-2000 The MathWorks, Inc.
%  $Revision: 1.10 $

    fig_position = input(1);
    leng = input(2);
    starter = input(3);
    num_state = input(4);
    dec = input(5);
    plot_flag = input(6);

    handles = get(input(7), 'UserData');
	
    plot_curv_x = [get(handles(3), 'XData'), NaN];
    plot_curv_y = [get(handles(3), 'YData'), NaN];
    if length(plot_curv_x) > 3 * plot_flag
        leng_x = length(plot_curv_x);
        limi    = leng_x - 3 * plot_flag + 1;
        plot_curv_x = plot_curv_x(limi:leng_x);
        plot_curv_y = plot_curv_y(limi:leng_x);
    end;

    set(handles(3), 'XData', [plot_curv_x, fig_position-leng+.1, fig_position-leng+1],...
                      'YData', [plot_curv_y, bi2de(fliplr(de2bi(starter, num_state))),...
                       bi2de(fliplr(de2bi(dec, num_state)))]);
%    drawnow
