Convert table with many rows to table with single row with data in sequence
Mostrar comentarios más antiguos
What is an efficient way to assign values from one table (many rows and columns) to a table with one row.
Table 1: 3 variables with 10 entries each (10 rows x 3 columns) - VarNames: Start, End, Time & all values are numbers
Table 2: I want to extract data from Table 1 and input the values into Table 2 - VarNames: Start1, End1, Time1, Start2, End2, Time2, ... Start10, End10, Time10
For example:

The goal is to create something like below so that every column in Table2 doesn't need to have its own line of code; but I'm not sure if that's possible or realistic to do.
T2 = table();
x = 1;
while x<11
T2.Start(x) = T1(x,1);
T2.End(x) = T1(x,2);
T2.Time(x) = T1(x,3);
x = x+1;
end
Respuesta aceptada
Más respuestas (1)
David Hill
el 17 de Ag. de 2022
m=table2array(T1);
Categorías
Más información sobre Tables en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!