0001 function vb_util_line_trigger(this_x, y_data, line_clr)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 vb_define_process_trigger;
0019
0020
0021 if ~exist('this_x', 'var') this_x = []; end;
0022 if ~exist('y_data', 'var') y_data = []; end;
0023 if ~exist('line_clr', 'var') line_clr = []; end;
0024 [this_x, y_data, line_clr] = inner_check_arguments(this_x, y_data, line_clr);
0025
0026
0027
0028 trigger_label = sprintf('%d', this_x);
0029
0030 y_max = max(y_data);
0031 th = text(this_x, inner_label_y(y_max) , trigger_label);
0032 set(th, 'Tag', DPT_TRIGGERTEXT_TAG);
0033 if vb_matlab_version('>=', '6.5')
0034 set(th,'BackgroundColor','y');
0035 end
0036
0037 x_data = this_x .* ones(size(y_data));
0038 line_h = line('XData', x_data, 'YData', y_data, ...
0039 'Color', line_clr, ...
0040 'Tag', DPT_TRIGGERLINE_TAG, ...
0041 'LineStyle', '-'); hold on;
0042 set(line_h, 'UserData', [line_h th]);
0043
0044
0045
0046
0047
0048
0049
0050
0051 function [this_x, y_data, line_clr] = ...
0052 inner_check_arguments(this_x, y_data, line_clr)
0053
0054 if isempty(this_x) error('this_x is a required parameter'); end;
0055 if isempty(y_data) error('y_data is a required parameter'); end;
0056
0057 if isempty(line_clr) line_clr = 'g'; end;
0058
0059
0060
0061
0062
0063 function label_y = inner_label_y(y_max)
0064 THIS_INFLATION = 500;
0065 label_y = y_max + THIS_INFLATION;
0066 return;
0067
0068
0069
0070