In MATLAB Grader, how can I capture the printed output of a script type problem?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Benjamin Walker
el 29 de Mzo. de 2024
Comentada: Dyuman Joshi
el 30 de Mzo. de 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 comentarios
Respuesta aceptada
Cris LaPierre
el 30 de Mzo. de 2024
You are correct. The only way to do this in Grader is to use evalc.
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing 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!