dataset2table
Convert dataset array to table
Syntax
Description
Examples
Convert Dataset Array to Table
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 Arguments
ds
— Input dataset array
dataset array
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 Arguments
t
— Output table
table
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.
Version History
Introduced in R2013b
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)