Home > functions > device > eeg > biosemi > vb_axisends_get.m

vb_axisends_get

PURPOSE ^

get values of specified both ends

SYNOPSIS ^

function [begin_val, end_val] = vb_axisends_get(axisends, type_tag, axis_tag)

DESCRIPTION ^

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

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005