xlswrite formatting error. Naming multiple sheets
显示 更早的评论
I am very new to MATLAB.
Currently, I have to use the following code to export my data to Excel but would like to reduce the number of lines needed if possible and change the "sheet" name of all of them at once.
Data = {'MATLAB DATA'};
Data1 = {'Reactor Length (m)', 'Molar flow of A (mol/s)', 'Molar flow of B (mol/s)', 'Molar flow of C (mol/s)', 'Molar flow of D (mol/s)','Reaction Rate (mol/(m^3*s))'};
Data2 = [Z Fa Fb Fc Fd rA2];
Data3 = {'Reactor Radius (m)', Ro}
Data4 = {'Reactor Pressure (Bar)', P_Bar}
Data5 = {'Reactor Temperature (K)', T}
xlswrite('PFR_Data.xlsx', Data, '3 H2 1 CO2', 'A1:A6')
xlswrite('PFR_Data.xlsx', Data1, '3 H2 1 CO2', 'A3')
xlswrite('PFR_Data.xlsx', Data2, '3 H2 1 CO2', 'A4')
xlswrite('PFR_Data.xlsx', Data3, '3 H2 1 CO2', 'A2')
xlswrite('PFR_Data.xlsx', Data4, '3 H2 1 CO2', 'C2')
xlswrite('PFR_Data.xlsx', Data5, sheet, 'E2')
When I try
sheet = {'5 H2 1 CO2'}
xlswrite('PFR_Data.xlsx', Data, sheet, 'A1:A6')
I get the following error
Error using xlswrite (line 172)
Sheet argument must be a character vector or a whole number greater than 0.
Any help will be appreciated.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!