It looks like your issue using the append feature has to do with your data being a table. Try using writematrix with your data as a numerical array instead. Note this will not include your table variable names as headers, but should be achieveable by adding write step before you begin adding your data.
Dynamically adding to an excel sheet
6 次查看(过去 30 天)
显示 更早的评论
I have some EMG data that I processed and I want to export it into an Excel file. Because I am running a loop to process through multiple trials I wanted to export them all to the same spreadsheet, adding to the columns. With what I am currently using it exports each trial as a new row, but I need the data to all be exported into the same rows. Is there a way to do this?
for x= 1:12
Name=(char(all_files(data_files_index(x))));
newfilename= erase(Name, '_Feb_27_2021_conditionedEMG.mat');
newname= erase(newfilename, 'Subject 5_VTAS');
JASA.filename = newfilename;
JASA.SCM_L_EA = muscle_SCM_L_EA; % SCM_L_EA_CC_JTTT_T1
JASA.SCM_R_EA= muscle_SCM_R_EA;
JASA.UNE_L_EA = muscle_UNE_L_EA;
JASA.UNE_R_EA= muscle_UNE_R_EA;
JASA.UTR_L_EA_ = muscle_UTR_L_EA;
JASA.UTR_R_EA= muscle_UTR_R_EA;
JASA.SCM_L_MDF_ = muscle_SCM_L_MDF;
JASA.SCM_R_MDF1 = muscle_SCM_R_MDF;
JASA.UNE_L_MDF = muscle_UNE_L_MDF;
JASA.UNE_R_MDF_CA = muscle_UNE_R_MDF;
JASA.UTR_L_MDF = muscle_UTR_L_MDF;
JASA.UTR_R_MDF = muscle_UTR_R_MDF;
% These variables change with each trial
T = struct2table(JASA);
writetable(T, 'SO5 Data.xlsx', "WriteMode", "append")
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!