MATLAB 帮助中心
Convert dataset array to table
t = dataset2table(ds)
t = dataset2table(ds) converts a dataset array to a table.
t
ds
example
collapse all
Load the sample data, which contains nutritional information for 77 cereals.
load cereal;
Create a dataset array containing the calorie, protein, fat, and name data for the first five cereals. Label the variables.
Calories = Calories(1:5); Protein = Protein(1:5); Fat = Fat(1:5); Name = Name(1:5); cereal = dataset(Calories,Protein,Fat,'ObsNames',Name)
cereal = Calories Protein Fat 100% Bran 70 4 1 100% Natural Bran 120 3 5 All-Bran 70 4 1 All-Bran with Extra Fiber 50 4 0 Almond Delight 110 2 2
cereal.Properties.VarDescription = Variables(4:6,2);
Convert the dataset array to a table.
t = dataset2table(cereal)
t=5×3 table Calories Protein Fat ________ _______ ___ 100% Bran 70 4 1 100% Natural Bran 120 3 5 All-Bran 70 4 1 All-Bran with Extra Fiber 50 4 0 Almond Delight 110 2 2
Input dataset array to convert to a table, specified as a dataset array. Each variable in ds becomes a variable in the output table t.
Output table, returned as a table. The table can store metadata such as descriptions, variable units, variable names, and row names. For more information, see Tables.
Introduced in R2013b
table | dataset
table
dataset
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处