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 Center および File ExchangeSimulation, Tuning, and Visualization についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by