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

조회 수: 2 (최근 30일)
With the introduction of Cody Coursework, I'm often asked how to create problems requiring students process data files.

채택된 답변

MathWorks Community Team
MathWorks Community Team 2014년 2월 27일
편집: MathWorks Community Team 2014년 6월 9일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Test Execution에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by