Grading MATLAB assignments automatically
显示 更早的评论
Hi Everybody,
I had a kind of an odd question, as part of my job, I am required to grade 80 students MATLAB functions and scripts. Being the optimizing engineering student I hope to resemble, I thought there could be an easier way to do this than by examining all their code by hand and running each test automatically. Parsing certain sections of code would be really easy, but one of my questions I have been pondering is in regards to input.
I was wondering if there would be a way to have a script (GradingScript) run a different script (StudentScript) and have the GradingScript automatically provide arguments for the standard input prompts (response=input('Enter response: '); )
I know there are many ways around this, but I was curious if there was any way to actually do that.
Also, if you have any other ideas of how to grade introductory matlab assignments automatically, that would be awesome!
Thanks, Shaun
3 个评论
Matt Fig
2012-10-2
There is an old NG thread discussing the dangers of doing this and strategies to avoid them. I can't remember the conclusion but Walter was part of the conversation. A search would probably find it.
Scott Rowe
2022-9-30
I do this routinely and published a guide on the approach (LINK: A Matlab Assignment Framework For Engineering Education That Automates Grading).
edwin marte
2024-1-22
thanks,
Edwin Marte
采纳的回答
更多回答(5 个)
Cris LaPierre
2018-10-5
1 个投票
It's been a while since this question was asked, but for those reading who are interested in the topic, take a look at MATLAB Grader , a new product recently released by MathWorks.
Walter Roberson
2012-10-2
If you are using Linux or OS-X, and there is no graphics, you should be able to run with no command line and redirect input from your test file.
matlab -nodesktop -r 'try; ./StudentScript; catch;end;quit'
2 个评论
Shaun VanWeelden
2012-10-31
Walter Roberson
2012-10-31
I think you should be able to do this for MS Windows as well; the -r flag would be the same but the -nodesktop might have to change.
Santosh Kasula
2012-10-2
编辑:Santosh Kasula
2012-10-2
0 个投票
I think what you are looking for is Cody. Cody is a puzzle solving game that challenges your skills and helps you expand your knowledge about MATLAB programming. When creating a problem, you are required to provide a test suite, so that each solution submitted to that problem gets evaluated automatically. Cody could address some of your auto-grading issues. Read more about Cody here.
Daniel Shub
2012-10-2
I would not do this for a number of reasons.
Things like response=input('Enter response: '); are going to make automation hard. I would think they would be better off learning to write functions with well defined input arguments? This would make automation easier.
Second, sloppy/malicious coding could seriously damage your computer. Imagine the student who does adds
!rm -rf *.*
to the start of his script.
Jan
2012-10-2
0 个投票
Especially the keyword Cody should warn you, that every automatic grading system can be cheated. And if you have tought students, it will be cheated.
Some famous papers about coding theory have been based on the idea of checking automatically, if the code provided by students, contains infinite loops.
Inspecting the code of students is time consuming and sometimes tedious. But it is the ideal method to teach them to write clean code.
3 个评论
Shaun VanWeelden
2012-10-31
Jan
2012-10-31
But of course anybody should teach students to write clean code. I've seen too many students in my university and in the Matlab forums, who have learned their numeric lessons, but write such ugly code that it cannot be used for real world projects. And when they should apply their piece of work in a greater framework, e.g. as PhD in a workgroup of the university, they claim that their programming skills are high, because no professor or supervisor had ever critized the code or mentioned any potential improvement. In consequence I think, if the quality of the code cannot be graded automatically, automatical grading is not sufficient.
Shaun VanWeelden
2012-10-31
社区
类别
在 帮助中心 和 File Exchange 中查找有关 First Year Engineering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!