Main Content

hasValue

Determine if the attribute type is numeric or logical

Description

tf = hasValue(typeOfAttribute) returns a logical value that indicates if the enumerator in typeOfAttribute is either Numeric or Logical. hasValue returns logical 1 (true) for Numeric and Logical attributes. Otherwise returns logical 0 (false).

example

Examples

collapse all

Create an attributeType enumeration array.

Type = attributeType({'Numeric'; 'String'; 'Logical'; 'List'});

Check if any of the enumerator defined in the attributeType enumeration array is Numeric or Logical.

tf = zeros(0,length(Type));
for i = 1:length(Type)
    tf(i) = hasValue(Type(i)); 
end

Display the output. The value 1 is returned when an enumerator in the attributeType enumeration array is either Numeric or Logical. Otherwise, the value 0 is returned.

tf
tf = 1×4

     1     0     1     0

Input Arguments

collapse all

Type of attribute, specified as an attributeType enumeration. The enumerator in the attributeType enumeration can be Numeric, String, Logical, List, or None.

Version History

Introduced in R2018b

See Also

Objects