Vertically Concatenating Tables in a Loop
13 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi there I am trying to perform a calculation on variables in each trial of a data set and add it to the table and concationte the tables with caluclated variables over the course of 10 trials. So far I have this code
for m = 1:10
Trial = [COPData(m).data,OPALData(m).data]; %Original Table
COPTv_y = diff(Trial.COPy)./diff(Trial.Time); %Center of pressure calcualtion velocity in y-direction
Table = addvars(Trial,COPTv_y,'NewVariableNames',{'CoP_velocity'}); %adds new CoPv clalcuation to table
end
but it just produces 10 seperate tables in the workspace all named "Table" and I was to stack the tables on top of eachother so it contains all the data including the new calucalted variable across the 10 tirals. Any help is greatly appreciated! Thank you so much!
0 Commenti
Risposta accettata
Chunru
il 26 Mar 2024
TableAll = [];
for m = 1:10
Trial = [COPData(m).data,OPALData(m).data]; %Original Table
COPTv_y = diff(Trial.COPy)./diff(Trial.Time); %Center of pressure calcualtion velocity in y-direction
T = addvars(Trial,COPTv_y,'NewVariableNames',{'CoP_velocity'}); %adds new CoPv clalcuation to table
TableAll = [TableAll; T]; % append T to TableAll
end
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!