Group: | Information and Control |
See also: | list size |
Function: | comp | |
Description: | Checks whether an object has a specific component or not. If the first argument is a string, the object with the specified name is regarded as a list object. |
Usage: | x = comp(obj, com) | |
Input: | ||
obj | list object or string | |
com | string, the name of the component | |
Output: | ||
x | scalar |
-1 ... object with name obj does not exist
0 ..... object has no component with name com
>0 ... position of the component in the object obj
x1=1 x2=2 x=list(x1,x2) comp(x,"x1") ;existing element comp(x,"x3") ;nonexisting element comp("de","x3") ;nonexisting object "de"
position of x1 =1, 0 for nonexisting element x3, -1 for nonexisting object de