How to set names to each colunm and row using "writematrix"?
45 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tony Castillo
am 9 Feb. 2022
Kommentiert: Tony Castillo
am 9 Feb. 2022
Dear Mathcoders,
I just wonder how to name the colunms and rows of table done by using writematrix, have not found a workaround for this yet:
B=flip([Irr_ SOC_ PV_Harvest_ Mean_consump ElecEnergy_cons PVenergy_ ...
Power_Batt_ heating_c_ Cooling_c HDW_c EV_ Sp_ Power_Build_]);
Labels=["Irr", "SOC", "PVHarvest", "Mecons", "ElecEne", "PVen", "PBatt", "heatc", "Coc", "HDc", "EV", "Sp", "PBuild"];
writematrix(B, Labels, 'Means.xls')
0 Kommentare
Akzeptierte Antwort
Turlough Hughes
am 9 Feb. 2022
B = rand(100,13);
Labels=["Irr", "SOC", "PVHarvest", "Mecons", "ElecEne", "PVen", "PBatt", "heatc", "Coc", "HDc", "EV", "Sp", "PBuild"];
writetable(array2table(B, 'VariableNames', Labels), 'Means.xls')
Weitere Antworten (1)
Walter Roberson
am 9 Feb. 2022
You can first writecell the header and then writematrix with WriteMode append.
Or array2table using the labels as variable names and writetable()
0 Kommentare
Siehe auch
Kategorien
Mehr zu File Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!