Documentation Center

  • Trial Software
  • Product Updates

iptcheckinput

Check validity of array

iptcheckinput will be removed in a future release. Use validateattributes instead.

Syntax

iptcheckinput(A, classes, attributes, func_name, var_name, arg_pos)

Description

iptcheckinput(A, classes, attributes, func_name, var_name, arg_pos) checks the validity of the array A and issues a formatted error message if it is invalid.

classes is a cell array of strings specifying the set of classes to which A is expected to belong. For example, if you specify classes as {'logical' 'cell'}, A is required to be either a logical array or a cell array. The string 'numeric' is interpreted as an abbreviation for the classes uint8, uint16, uint32, int8, int16, int32, single, and double.

attributes is a cell array of strings specifying the set of attributes that A must satisfy. For example, if attributes is {'real' 'nonempty' 'finite'}, A must be real and nonempty, and it must contain only finite values. The following table lists the supported attributes in alphabetical order.

2d

nonempty

odd

twod

column

nonnan

positive

vector

even

nonnegative

real

 

finite

nonsparse

row

 

integer

nonzero

scalar

 

func_name is a string that specifies the name used in the formatted error message to identify the function checking the input.

var_name is a string that specifies the name used in the formatted error message to identify the argument being checked.

arg_pos is a positive integer that indicates the position of the argument being checked in the function argument list. iptcheckinput converts this value to an ordinal number and includes this information in the formatted error message.

Examples

To trigger this error message, create a three-dimensional array and then check for the attribute '2d'.

A = [ 1 2 3; 4 5 6 ];
B = [ 7 8 9; 10 11 12];
C = cat(3,A,B);
iptcheckinput(C,{'numeric'},{'2d'},'func_name','var_name',2)

The following shows the format of the error message and indicates which parts you can customize using iptcheckinput arguments.

See Also

| | | |

Was this topic helpful?