Home > wafo > multidim > sensortypeid.m

sensortypeid

PURPOSE ^

Return ID for sensortype name

SYNOPSIS ^

sensorid = sensortypeid(sensortype)

DESCRIPTION ^

 SENSORTYPEID Return ID for sensortype name 
  
   CALL:   sensorid = sensortypeid(sensortype) 
  
   sensorid   = integer defining the sensortype 
   sensortype = string defining the sensortype 
                valid options are: 
    'n'    : Surface elevation              (n=Eta)  (default) 
    'n_t'  : Vertical surface velocity 
    'n_tt' : Vertical surface acceleration 
    'n_x'  : Surface slope in x-direction  
    'n_y'  : Surface slope in y-direction 
    'n_xx' : Surface curvature in x-direction 
    'n_yy' : Surface curvature in y-direction 
    'n_xy' : Surface curvature in xy-direction 
    'P'    : Pressure fluctuation about static MWL pressure  
    'U'    : Water particle velocity in x-direction 
    'V'    : Water particle velocity in y-direction 
    'W'    : Water particle velocity in z-direction 
    'U_t'  : Water particle acceleration in x-direction 
    'V_t'  : Water particle acceleration in y-direction 
    'W_t'  : Water particle acceleration in z-direction 
    'X_p'  : Water particle displacement in x-direction from its mean position 
    'Y_p'  : Water particle displacement in y-direction from its mean position 
    'Z_p'  : Water particle displacement in z-direction from its mean position 
  
  Example: 
  sensortypeid(strvcat('W','v')) 
  sensortypeid('rubbish')   
  
  See also sensortype

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function sensorid = sensortypeid(sensortype) 
002 %SENSORTYPEID Return ID for sensortype name 
003 % 
004 %  CALL:   sensorid = sensortypeid(sensortype) 
005 % 
006 %  sensorid   = integer defining the sensortype 
007 %  sensortype = string defining the sensortype 
008 %               valid options are: 
009 %   'n'    : Surface elevation              (n=Eta)  (default) 
010 %   'n_t'  : Vertical surface velocity 
011 %   'n_tt' : Vertical surface acceleration 
012 %   'n_x'  : Surface slope in x-direction  
013 %   'n_y'  : Surface slope in y-direction 
014 %   'n_xx' : Surface curvature in x-direction 
015 %   'n_yy' : Surface curvature in y-direction 
016 %   'n_xy' : Surface curvature in xy-direction 
017 %   'P'    : Pressure fluctuation about static MWL pressure  
018 %   'U'    : Water particle velocity in x-direction 
019 %   'V'    : Water particle velocity in y-direction 
020 %   'W'    : Water particle velocity in z-direction 
021 %   'U_t'  : Water particle acceleration in x-direction 
022 %   'V_t'  : Water particle acceleration in y-direction 
023 %   'W_t'  : Water particle acceleration in z-direction 
024 %   'X_p'  : Water particle displacement in x-direction from its mean position 
025 %   'Y_p'  : Water particle displacement in y-direction from its mean position 
026 %   'Z_p'  : Water particle displacement in z-direction from its mean position 
027 % 
028 % Example: 
029 % sensortypeid(strvcat('W','v')) 
030 % sensortypeid('rubbish')   
031 % 
032 % See also sensortype   
033    
034  
035  
036 %History 
037 % by pab 2005 
038  
039   % Note the ordering of validnames can not be changed without changing 
040   % the order in functions dependent on this function 
041   validNames = strvcat('n','n_t','n_tt','n_x','n_y','n_xx',... 
042                        'n_yy','n_xy','p','u','v','w','u_t',.... 
043                        'v_t','w_t','x_p','y_p','z_p'); 
044   if nargin<1|isempty(sensortype) 
045     sensortype = 'n'; 
046   end 
047   if ischar(sensortype) 
048     %[C,ia,ib] = intersect(validNames,lower(sensortype),'rows'); 
049     N1 = size(sensortype,1); 
050     sensorid = repmat(nan,N1,1); 
051      
052     for ix = 1:N1 
053       tmp =    strmatch(lower(deblank(sensortype(ix,:))),validNames,'exact'); 
054       if ~isempty(tmp) 
055         sensorid(ix) = tmp; 
056       end 
057     end 
058   elseif isnumeric(sensortype) 
059     N = size(validNames,1); 
060     sensorid = sensortype; 
061     sensorid(sensorid>N) = nan; 
062   else  
063     error('Input must be character arrays!') 
064   end 
065   return

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003