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

3 ビュー (過去 30 日間)
Tristan
Tristan 2022 年 11 月 14 日
回答済み: Tristan 2022 年 11 月 15 日
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
RAGHUNATHRAJU DASHARATHA 2022 年 11 月 14 日
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
RAGHUNATHRAJU DASHARATHA 2022 年 11 月 14 日
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

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by