Unable to write data into excel file in append mode
조회 수: 11 (최근 30일)
이전 댓글 표시
filename = 'file.xlsx';
con = array2table(con);
T=array2table(M,'VariableNames',{'Accuracy','PPV','NPV','Sensitivity','Specificity','Mean Accuracy'});
writematrix('ConfusionMatrix',filename,'Sheet',1,'WriteMode','append')
writetable(con,filename,'Sheet',1,'WriteMode','append')
writecell({'Accuracy','PPV','NPV','Sensitivity_Recall_TPR','Specificity_Selectivity_TNR','Mean Accuracy'},filename,'Sheet',1,'WriteMode','append')
writetable(T,filename,'Sheet',1,'WriteMode','append') %'WriteVariableNames',false
Error:
Unable to determine range. Range must be of the form 'A1' (cell), 'A:B' (column-select), '1:5' (row-select), 'A1:B5'
(rectangle-select), or a valid named range in the sheet.
If we specify the range, it will show error range cannot be specified in append mode.
Kindly help to solve this issue
댓글 수: 1
Mathieu NOE
2021년 9월 29일
hi
seems a bit complicated , all these sucessive calls to writematrix / writetable / writecell
is there any chance to put together a single table and do only one call to writetable ?
also sharing the data (xls) files would help
답변 (1개)
Marcel
2022년 11월 30일
편집: Marcel
2022년 11월 30일
Im using this code to append text to a excel file. You can also use the parameter "Range", "A1:G1" (untested), but you'd need to remove the "WriteMode" parameter, because you cant have both
writecell(cellstr("Test"), "file.xls", 'WriteMode','append');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!