Second (50)
Third (10)
NoPlace (0)
end
end
The enumeration member inherits the methods of the int32 class (except the colon
operator). Use these enumerations like numeric values (summed, sorted, averaged).
isa(Results.Second,'int32')
ans =
1
For example, use enumeration names instead of numbers to rank two teams:
Team1 = [Results.First, Results.NoPlace, Results.Third, Results.Second];
Team2 = [Results.Second, Results.Third, Results.First, Results.First];
Perform int32 operations on these Results enumerations:
sum(Team1)
ans =
160
mean(Team1)
ans =
40
sort(Team2,'descend')
ans =
First First Second Third
Team1 > Team2
ans =
1 0 0 0
sum(Team1) < sum(Team2)
Enumerations Derived from Built-In Types