locked output files students can turn in

1 次查看(过去 30 天)
Hello,
I'm wondering if I can get some input on a problem. I'm trying to save data generated in an app (made with AppDesigner) into a spreadsheet or other output file. Students will be using this program, and I'd like for there to be a way to password protect the file or something so the students can't modify their answers or adjust them prior to turning them in. I see two options, but I'm curious what other solutions may exist:
  1. use ActiveX to open excel, password protect, and save the file - but this requires whoever downloads the app to have microsoft excel. I'd like this to be more versatile as many students don't. An example I found combing MATLAB answers looks something like this:
%set password
openPassword = "password";
protectPassword = "password";
%open and set up
excel = actxGetRunningServer('Excel.Application'); % attach to open Excel instance
excel.Visible = true; % ensure Excel is visible
wb = excel.Workbooks.Add();% add a new workbook to the workbooks collection
wb.Password = openPassword;% set the password property
ws = wb.ActiveSheet(); % set ws variable to the active worksheet in wb
% write data
ws.Range("A1:A2").Value2 = {'hello','world'}
% protect the sheet, save, and close
wb.Protect(protectPassword, true, true);
wb.SaveAs(filepath);
wb.Close();
2. use the sendmail function to send the data to the instructor via e-mail when the student clicks a "submit" callback function. Can you configure sendmail for an app that is distributed so that all submissions are sent to the same e-mail? How does sendmail work when packaged into an app?
Any other ideas?
Thanks!

采纳的回答

Steven Lord
Steven Lord 2020-8-25
What information are the students being called upon to provide as the work to be graded? A modified or new app? A script or function? Or just several arrays of numbers?
Rather than trusting the spreadsheet of expected results that you receive from the same source (the students) that provide the actual results, you could give them a test suite that they can use to validate their work and grade them using a separate test suite that you don't give them. Three of us wrote a guest blog post on Loren Shure's blog seven years ago (wow! It's been that long?) showing a way you could do this. There are some more advanced techniques you could use in place of manually manipulating the path to make each students' functions available to be tested[*] but I think this "two-tiered" testing approach will help both you and your students.
[*] As one example, define a class-related function that calls dir to list the directories containing each student's submission. Use that function to populate a ClassSetupParameter propery. Finally have a TestClassSetup method add each directory in turn to the MATLAB path using a matlab.unittest.fixture.PathFixture for that particular run of the tests.
  5 个评论
Rik
Rik 2020-8-26
Most universities and schools also have student IDs. That should guarantee each student to have a unique seed:
studentID='s123456789';
seed=str2double(studentID(isstrprop(studentID,'digit')));
rng(seed)
This only works if you have a way to convert the IDs to an integer less then 2^32. The code above only works if there are 9 digits or fewer.
Shae Morgan
Shae Morgan 2020-8-26
@Rik
Another excellent suggestion. Thanks!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Downloads 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by