MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
The variable, SelfAssessedHealthStatus, contains four unique values: Excellent,
Fair, Good, and Poor.

Convert SelfAssessedHealthStatus to an ordinal categorical array, such that the
categories have the mathematical ordering Poor < Fair < Good < Excellent.

T.SelfAssessedHealthStatus = categorical(T.SelfAssessedHealthStatus,...
{'Poor','Fair','Good','Excellent'},'Ordinal',true);

Print a Summary

View the data type, description, units, and other descriptive statistics for each variable by
using summary to summarize the table.

format compact

summary(T)

Variables:
Age: 100x1 double
Values:
Min 25
Median 39
Max 50
Gender: 100x1 categorical
Values:
Female 53
Male 47
Height: 100x1 double
Values:
Min 60
Median 67
Max 72
Weight: 100x1 double
Values:
Min 111
Median 142.5
Max 202
SelfAssessedHealthStatus: 100x1 ordinal categorical
Values:
Poor 11
Fair 15
Good 40
Excellent 34
Location: 100x1 categorical

8 Categorical Arrays

Free download pdf