Home > Applications > Horace > admin > isa_size.m

iFit/isa_size

PURPOSE ^

Check if a variable has both a given type and size. Utility routine, but

SYNOPSIS ^

function result = isa_size (var, check_size, check_type)

DESCRIPTION ^

 Check if a variable has both a given type and size. Utility routine, but
 probably not very efficient if needed in a large loop.

 Syntax:
   >> ok = isa_size (var, check_size)
   >> ok = isa_size (var, check_size, check_type)

 Input:
 ------
   var         Variable to be checked
   check_size  Required size of variable
                - the size of the array e.g. [2,3] or [1,1] or [4,5,100]
                - 'row' if a row vector of unspecified length
                - 'column' if a column vector of unspecified length
                - 'vector' if either a row or column vector

   check_type  Matlab variable type to check against.
               In addition, will accept 'cellstr' (not a recognised
              keyword by the matlab intrinsic function 'isa', as it
              is not a class, but a special case of a cell)

 Output:
 --------
   ok          =true  if var has desired type and size
               =false otherwise

   e.g. check if variable w is a 4x3 matrix of type double:
   >> ok = isa_size (w, [4,3], 'double')

   e.g. is variable w a row vector:
   >> ok = isa_size (w, [1,3], 'double')

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Mon 26-Nov-2018 15:08:42 by m2html © 2005. iFit (c) E.Farhi/ILL EUPL 1.1