MATLAB Examples


Test for the presence of a string in a list of possible values



errmsg = check_ismember(Parameter,PropValue,Accepted_Values) tests if the PropValue value is a string and is included in the available values given in Accepted_Values. It returns his result in errmsg. If the test is passed successfully, the string errmsg is empty. If the test is failed, the string errmsg specifies the error. This message includes the name Parameter.

Input parameters

Parameter: name (string) of the parameter tested.

PropValue: value to test.

Accepted_Values: m x1 or 1x m cell array of the m acceptable strings.

Output parameters

errmsg: Error message. It is an empty string when the test is successful.


Accepted_Values = {'regular' 'random' 'file'};
errmsg = check_ismember('Points_distribution','stretch',Accepted_Values);
The value of the parameter "Points_distribution" must be one of those:
 - regular
 - random
 - file

See also


Copyright 2013 Mathieu Gendron