Home > vbmeg > functions > device > eeg > biosemi > vb_util_line_trigger.m

vb_util_line_trigger

PURPOSE ^

make a vertical line of trigger

SYNOPSIS ^

function vb_util_line_trigger(this_x, y_data, line_clr)

DESCRIPTION ^

 make a vertical line of trigger
 [usage]
   vb_util_line_trigger(this_x, y_data, line_clr)
 [input]
     this_x : <required> X value
     y_data : <required> data set of Y which will be set as 'YData'
   line_clr : <optional> color of line ['g']
 [output]
   none
 [note]
 [history]
   2006-12-22 (Sako) initial version

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function vb_util_line_trigger(this_x, y_data, line_clr)
0002 % make a vertical line of trigger
0003 % [usage]
0004 %   vb_util_line_trigger(this_x, y_data, line_clr)
0005 % [input]
0006 %     this_x : <required> X value
0007 %     y_data : <required> data set of Y which will be set as 'YData'
0008 %   line_clr : <optional> color of line ['g']
0009 % [output]
0010 %   none
0011 % [note]
0012 % [history]
0013 %   2006-12-22 (Sako) initial version
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 vb_define_process_trigger;
0019 
0020 % --- CHECK ARGUMENTS --- %
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 % --- MAIN PROCEDURE --------------------------------------------------------- %
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 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0045 
0046 
0047 % --- INNER FUNCTIONS -------------------------------------------------------- %
0048 %
0049 % --- inner_check_arguments()
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 % --- end of inner_check_arguments()
0060     
0061 % --- inner_label_y()
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 % --- end of inner_label_y()
0069 
0070 %%% END OF FILE %%%

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005