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

3 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

RAGHUNATHRAJU DASHARATHA
RAGHUNATHRAJU DASHARATHA il 14 Nov 2022
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 Commenti
Tristan
Tristan il 14 Nov 2022
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
RAGHUNATHRAJU DASHARATHA il 14 Nov 2022
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

Accedi per commentare.

Più risposte (1)

Tristan
Tristan il 15 Nov 2022
Perfect it worked, thanks

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by