table2dataset
(Not Recommended) Convert table to dataset array
The dataset
data type is not recommended. To work with heterogeneous data,
use the MATLAB®
table
data type instead. See MATLAB
table
documentation for more information.
Syntax
Description
Examples
Convert a Table to a Dataset Array
Load the sample data, which contains nutritional information for 77 cereals.
load cereal;
Create a table 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 = table(Calories,Protein,Fat,'RowNames',Name)
cereal=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
Convert the table to a dataset array.
ds = table2dataset(cereal)
ds = 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
t
— Input table
table
Input table to convert to a dataset array, specified as a table. Each
variable in t
becomes a variable in the output dataset
array ds
.
Data Types: table
Output Arguments
ds
— Output dataset array
dataset array
Output dataset array, returned as a dataset array containing the variables
from the input table t
.
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)