MATLAB Function Reference | Go to function: | Search Help Desk

checkval | See Also

Check if some value meets requirements

Syntax

    s = checkval(v,type,prefix,dims,bounds,options)

Description

`s = checkval(v,type,prefix,dims,bounds,options)` check if `v` is of type `type`, of dimension `dims` and meets the additional criterions specified inside `options`. Prefix is added in front of the error message. `bounds` is used to specify a limit for the elements of the matrix (if `v` is a cell array, bounds is used to check the type of the objects) `t` can be:

- `'numeric'` A numeric matrix
- `'real'` A real matrix
- `'int'` An integer matrix
- `'zero'` A null matrix
- `'positive'` A real positive matrix
- `'negative'` A real negative matrix
- `'intpos'` A integer positive matrix
- `'intneg'` A integer negative matrix
- `'char'` An array of strings
- `'struct'` A structure
- `'cell'` A cell array
- `any name of class` The class to which should belong `v`
- `'any'` Any data type

`dims` is a cell array (one element for each dimension) whose the elements can be:

- `[-1]` For any size
- `[x]` For a specified size
- `[min:max]` For a range of size
- `[x y z ...]` For a descrete number of sizes
- `[0]` At the end indicates a constraint on the number of dimensions

`options` is a cell array (one element fo each dimension) whose the elements can be:

- `'even'` For an even size of the matrix
- `'odd'` For an odd size of the matrix
- `'ascending'` To check if elements are in ascending order
- `'descending'` To check if elements are in descending order
- `'any'` For no additional check

See Also

checkargs

[ Help Desk ]