S = table2struct(T)
S = table2struct(T, "ToScalar", true)
| Paramètre | Description |
|---|---|
| T | un objet table |
| Paramètre | Description |
|---|---|
| S | Structure. |
S = table2struct(T) convertit la tableT en un tableau de structures S, où chaque variable deT est représentée comme un champ dans S.
Si T est une table m-by-n,S sera un tableau de structures m-by-1 avec n champs.
La sortieS ne contiendra pas les propriétés de table provenant deT.Properties.
S = table2struct(T, "ToScalar", true) convertit la tableT en une structure scalaire S, où chaque variable deT devient un champ dans S.
Si T est une table m-by-n,S contiendra n champs, et chaque champ aura m lignes.
Names = {'John'; 'Alice'; 'Bob'; 'Diana'};
Age = [28; 34; 22; 30];
Height = [175; 160; 180; 165];
Weight = [70; 55; 80; 60];
T = table(Names, Age, Height, Weight)
S1 = table2struct(T)
S1 = table2struct(T, "ToScalar", true)
| Version | Description |
|---|---|
| 1.8.0 | version initiale |