I want to put a column of information back into an excel sheet

1 次查看(过去 30 天)
I'm using an excel sheet to calculate grades
lear all
data = xlsread('CengGrades.xlsx');
Homework = data(:,2);
Incourse = data(:,3);
Project = data(:,4);
Homework_Grade = Homework .* 0.2;
Incourse_Grade = Incourse .* 0.4;
Project_Grade = Project .* 0.4;
HG = Homework_Grade;
IG = Incourse_Grade;
PG = Project_Grade;
Final_Grade = HG + IG + PG;
FG = Final_Grade;
Ik some of the code is redundant, but i like it this way.
I want to input FG or Final_Grade back into the excel sheet

采纳的回答

RAGHUNATHRAJU DASHARATHA
A per my understanding you want to add a new column of information back to the excel sheet.
you can add the following lines of code to do that
data=[data FG]; %to append the new column to the exisitng data
xlswrite('CengGrades.xlsx' ,data,'Sheet1','A1'); % to write the new data to excelsheet
for further more go through the link
  2 个评论
Tristan
Tristan 2022-11-14
The xlswrite command didn't work, I keep getting this error
Error using xlswrite (line 224)
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: SaveAs method of Workbook class failed
Help File: xlmain11.chm
Help Context ID: 0
RAGHUNATHRAJU DASHARATHA
you can also do the following
FG= table(FG);
writetable(FG,'CengGrades.xlsx','Sheet',1,'Range','D1'); % D1 is the column of excelsheet.
%you can use column
% of your choice
for more infromation go through this link

请先登录,再进行评论。

更多回答(1 个)

Tristan
Tristan 2022-11-15
Perfect it worked, thanks

标签

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by