MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Median 142.5
Max 202


ID: 100x1 double


Values:


Min 120
Median 5485.5
Max 9706


Return the size of the table.


size(T)


ans = 1×2


100 5


T contains 100 rows and 5 variables.


Create a new, smaller table containing the first five rows of T and display it. You can use
numeric indexing within parentheses to specify rows and variables. This method is similar
to indexing into numeric arrays to create subarrays. Tnew is a 5-by-5 table.


Tnew = T(1:5,:)


Tnew=5×5 table
Gender Smoker Height Weight ID




'Male' true 71 176 8148
'Male' false 69 163 9058
'Female' false 64 131 1270
'Female' false 67 133 9134
'Female' false 64 119 6324


Create a smaller table containing all rows of Tnew and the variables from the second to
the last. Use the end keyword to indicate the last variable or the last row of a table. Tnew
is a 5-by-4 table.


Tnew = Tnew(:,2:end)


Create and Work with Tables
Free download pdf