MATLAB Examples

check_ismember

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

Contents

Description

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.

Examples

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

See also

errmsg_w_list_of_names

Copyright 2013 Mathieu Gendron