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

vb_axisends_set

PURPOSE ^

set axisends value of both ends

SYNOPSIS ^

function axisends = vb_axisends_set(axisends,type_tag, axis_tag, begin_val, end_val)

DESCRIPTION ^

 set axisends value of both ends
 [usage]
   axisends = vb_axisends_set(axisends, type_tag, axis_tag, begin_val, end_val)
 [input]
    axisends : <required> <struct>
             :  You can see this structure below (output).
    type_tag : <required> tag of setting type. case-insensitive
             :  'ORIGINAL' : original begin and end value
             :    'SLIDER' : base begin and end value for slider
             :  'PREVIOUS' : previous begin and end value
    axis_tag : <required> tag of axis type ('X' or 'Y'). case-insensitive
   begin_val : value of begin
     end_val : value of end
 [output]
    axisends : <struct> both ends set. its fields are as follows
             :   original_x <both_ends>
             :   slider_x   <both_ends>
             :   previous_x <both_ends>
             :   original_y <both_ends>
             :   slider_y   <both_ends>
             :   previous_y <both_ends>
             :
             :   <struct : both_ends>
             :      begin
             :      end
 [note]
 
 [history]
   2007-02-19 (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 axisends = vb_axisends_set(axisends, ...
0002   type_tag, axis_tag, begin_val, end_val)
0003 % set axisends value of both ends
0004 % [usage]
0005 %   axisends = vb_axisends_set(axisends, type_tag, axis_tag, begin_val, end_val)
0006 % [input]
0007 %    axisends : <required> <struct>
0008 %             :  You can see this structure below (output).
0009 %    type_tag : <required> tag of setting type. case-insensitive
0010 %             :  'ORIGINAL' : original begin and end value
0011 %             :    'SLIDER' : base begin and end value for slider
0012 %             :  'PREVIOUS' : previous begin and end value
0013 %    axis_tag : <required> tag of axis type ('X' or 'Y'). case-insensitive
0014 %   begin_val : value of begin
0015 %     end_val : value of end
0016 % [output]
0017 %    axisends : <struct> both ends set. its fields are as follows
0018 %             :   original_x <both_ends>
0019 %             :   slider_x   <both_ends>
0020 %             :   previous_x <both_ends>
0021 %             :   original_y <both_ends>
0022 %             :   slider_y   <both_ends>
0023 %             :   previous_y <both_ends>
0024 %             :
0025 %             :   <struct : both_ends>
0026 %             :      begin
0027 %             :      end
0028 % [note]
0029 %
0030 % [history]
0031 %   2007-02-19 (Sako) initial version
0032 %
0033 % Copyright (C) 2011, ATR All Rights Reserved.
0034 % License : New BSD License(see VBMEG_LICENSE.txt)
0035 
0036 % --- CHECK ARGUMENTS --- %
0037 if ~exist('axisends',  'var'),  axisends = []; end;
0038 if ~exist('type_tag',  'var'),  type_tag = []; end;
0039 if ~exist('axis_tag',  'var'),  axis_tag = []; end;
0040 if ~exist('begin_val', 'var'), begin_val = []; end;
0041 if ~exist('end_val',   'var'),   end_val = []; end;
0042 [axisends, type_tag, axis_tag, begin_val, end_val] = ...
0043   inner_check_arguments(axisends, type_tag, axis_tag, begin_val, end_val);
0044 
0045 % --- MAIN PROCEDURE --------------------------------------------------------- %
0046 %
0047 switch type_tag
0048   case  'ORIGINAL'
0049     switch axis_tag
0050       case  'X'
0051         axisends.original_x.begin = begin_val;
0052         axisends.original_x.end   = end_val;
0053       case  'Y'
0054         axisends.original_y.begin = begin_val;
0055         axisends.original_y.end   = end_val;
0056     end
0057 
0058   case  'SLIDER'
0059     switch axis_tag
0060       case  'X'
0061         axisends.slider_x.begin = begin_val;
0062         axisends.slider_x.end   = end_val;
0063       case  'Y'
0064         axisends.slider_y.begin = begin_val;
0065         axisends.slider_y.end   = end_val;
0066     end
0067     
0068   case  'PREVIOUS'
0069     switch axis_tag
0070       case  'X'
0071         axisends.previous_x.begin = begin_val;
0072         axisends.previous_x.end   = end_val;
0073       case  'Y'
0074         axisends.previous_y.begin = begin_val;
0075         axisends.previous_y.end   = end_val;
0076     end
0077 end
0078 %
0079 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0080 
0081 % --- INNER FUNCTIONS -------------------------------------------------------- %
0082 %
0083 function [axisends, type_tag, axis_tag, begin_val, end_val] = ...
0084   inner_check_arguments(axisends, type_tag, axis_tag, begin_val, end_val)
0085 
0086 % need not check axisends
0087 % if isempty(axisends) ...
0088 
0089 if isempty(type_tag),  error('type_tag is a required parameter'); end;
0090 if isempty(axis_tag),  error('axis_tag is a required parameter'); end;
0091 if isempty(begin_val), error('begin_val is a required paramter'); end;
0092 if isempty(end_val),   error('end_val is a required paramter');   end;
0093 
0094 if begin_val > end_val
0095   tmp_begin_val = begin_val;
0096   begin_val = end_val;
0097   end_val = tmp_begin_val;
0098 end
0099 
0100 type_tag = upper(type_tag);
0101 axis_tag = upper(axis_tag);
0102 
0103 if ~strcmp(type_tag, 'ORIGINAL') ...
0104     && ~strcmp(type_tag, 'SLIDER') ...
0105     && ~strcmp(type_tag, 'PREVIOUS')
0106     error('unknown type_tag : %s', type_tag);
0107 end
0108 
0109 if ~strcmp(axis_tag, 'X') && ~strcmp(axis_tag, 'Y')
0110   error('unknown axis_tag : %s', axis_tag);
0111 end
0112 
0113 %
0114 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0115 
0116 %%% END OF FILE %%%

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