Excel Reading and Processing
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Fangjun Jiang
am 2 Sep. 2011
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 Kommentare
Fangjun Jiang
am 3 Sep. 2011
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.
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!