How do I create problems in Cody Coursework which require students to process data file(s)?

2 visualizaciones (últimos 30 días)
With the introduction of Cody Coursework, I'm often asked how to create problems requiring students process data files.

Respuesta aceptada

MathWorks Community Team
MathWorks Community Team el 27 de Feb. de 2014
Editada: MathWorks Community Team el 9 de Jun. de 2014
Here's how:
First, prepare the data file(s) you wish students' code to access.
Second, post the data file(s) somewhere online accessible by Cody Coursework. This must not be behind the school's firewall, it must be publicly accessible. One option is to use the public folder of a free dropbox account. If using DropBox, it will help to "copy the public link" using their web interface.
Third, design your Test Suite to load the data file into the students' current working folder before calling the students' code to test. Here's an example:
%%Prepare data files for student
in_f='http://url/datafile.csv';
out_f='./datafile.csv';
urlwrite(in_f,out_f);
% check to ensure the file loaded ok
fid=fopen(out_f);
assert(isequal(CheckFile(),1));
other tests follow
Alternatively, for more advanced students, you could replace the third step by offering students a function template with code to bring the data into the local folder in which their code will be run by Cody Coursework. For example:
function result = student_code(input)
% hint for students, keep this template code
urlwrite('http://url/datafile.csv','./datafile.csv');
addpath('.');
% students' TODO: insert your code here:
% students, please do not modify code outside these comments
end
Either way, students can now use standard MATLAB file operations to open and manipulate the data file(s) loaded into their current working folder.
Please note, to ensure system reliability, Cody Coursework resets system state each time a solution attempt is tested. This is why the file is loaded on each execution of the Test Suite.

Más respuestas (0)

Categorías

Más información sobre Simulation, Tuning, and Visualization en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by