Excel Reading and Processing
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Fangjun Jiang
el 2 de Sept. de 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 comentarios
Fangjun Jiang
el 3 de Sept. de 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.
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!