Could not compare values in DATA and VALUESET using the equality operator.

Post Reply
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

Could not compare values in DATA and VALUESET using the equality operator.

Post by matlab1 »

Could not compare values in DATA and VALUESET using the equality operator.
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

Re: Could not compare values in DATA and VALUESET using the equality operator.

Post by matlab1 »

You can use

=

for comparing value in Categorical Arrays.

Categorical Arrays
Arrays of qualitative data with values from a finite set of discrete, nonnumeric data
categorical is a data type to store data with values from a finite set of discrete categories. For example, the syntax C = categorical({'R','G','B','B','G','B'}) creates a categorical array with six elements that belong to the categories R, G, or B.

A categorical array provides efficient storage and convenient manipulation of nonnumeric data, while also maintaining meaningful names for the data values. The categories can have a natural order, but it is not required.

for more information

https://www.mathworks.com/help/matlab/categorical-arrays.html

Order of Categories
categorical is a data type to store data with values from a finite set of discrete categories, which can have a natural order. You can specify and rearrange the order of categories in all categorical arrays. However, you only can treat ordinal categorical arrays as having a mathematical ordering to their categories. Use an ordinal categorical array if you want to use the functions min, max, or relational operations, such as greater than and less than.

The discrete set of pet categories {'dog' 'cat' 'bird'} has no meaningful mathematical ordering. You are free to use any category order and the meaning of the associated data does not change. For example, pets = categorical({'bird','cat','dog','dog','cat'}) creates a categorical array and the categories are listed in alphabetical order, {'bird' 'cat' 'dog'}. You can choose to specify or change the order of the categories to {'dog' 'cat' 'bird'} and the meaning of the data does not change.

ordinal categorical arrays contain categories that have a meaningful mathematical ordering. For example, the discrete set of size categories {'small', 'medium', 'large'} has the mathematical ordering small < medium < large. The first category listed is the smallest and the last category is the largest. The order of the categories in an ordinal categorical array affects the result from relational comparisons of ordinal categorical arrays.

https://www.mathworks.com/help/matlab/matlab_prog/ordinal-categorical-arrays.html
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest