Loc() and Contains() return the positions of the values. Loc() returns the results in a matrix, and Contains() returns the results as a number.
•
|
The Loc function returns each occurrence of a repeated value. Contains() returns only the first occurrence of a repeated value.
|
•
|
•
|
To assess whether an item is in a list, use Loc() and Contains() with >0. A returned value of zero means that the item is not in the list. A returned value of 1 means that the item is in the list at least once.
|
注意:For details about matrix manipulation and a description of the equivalent Loc() command for matrices, see Matrices.
Loc( nameList, "Katie" );
Contains( nameList, "Katie" );
Loc( nameList, "Erin" );
Contains( nameList, "Erin" );
Loc( numList, 8 );
Contains( numList, 8 );