In MATLAB Grader, how can I capture the printed output of a script type problem?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Benjamin Walker
am 29 Mär. 2024
Kommentiert: Dyuman Joshi
am 30 Mär. 2024
My understanding is that the expected way to capture the printed output of code is using evalc. I understand how I would do this for a function-type problem, but is there a name I can pass into evalc to call a learner's script for a script-type problem?
An example problem:
(a) Create a variable x=5
(b) Create a variable y=2*x, and display its value using the disp function. This should be the only output printed by your code.
I would like to be able to mark as incorrect submissions such as
x = 5
y = 2*x
disp(y)
to force students to learn how to use semicolons, etc.
I was envisioning something along the lines of
learner_output = evalc('learnerScript');
assert(strcmp(learner_output, reference_output))
3 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 30 Mär. 2024
You are correct. The only way to do this in Grader is to use evalc.
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing 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!