Excel Reading and Processing
3 次查看(过去 30 天)
显示 更早的评论
I need to read marks one by one from one excel sheet (for eg: Marks for Maths & Chem arranged column wise for 100 students)calculate their grade (For eg: If Marks Above 50 Grade A else Grade B)and write it to another sheet in the corresponding cells. Can someone help me out this using actxserver.Thanks in advance.
0 个评论
回答(1 个)
Fangjun Jiang
2011-9-2
Do you have to use actxserver? If not, why not use xlsread?
[Num,Txt,Raw]=xslread('StudentMark.xls')
For example, if
Num=[90 40;70 80;30 60;60 20;20 80]
Grade=repmat({'B'},size(Num))
Grade(Num>50)={'A'}
xlswrite('StudentGrade.xls',Grade)
2 个评论
Fangjun Jiang
2011-9-3
You can use more input arguments of the xlsread and xlswrite function. xlsread(File, Sheet, Range) xlswrite(File,Data,Sheet, Range). However, I believe it's more efficient for you to read in all the data once, process it and then write it back. If the sheet is huge and you don't have enough RAM to hold all the data at once, you might want to considering reading/writing multiple times. xlsread() and xlswrite() have lots of overhead. It will be slow if you want to do read and write for each student.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!