필터 지우기
필터 지우기

MATLAB Grader: What should my assessment return when it determines a student solution is correct or incorrect?

조회 수: 32 (최근 30일)
Let's say the assignment is to create (and leave open) a figure with three subplots and one of the subplots should have the title "Oscillating Motion". I want to use an assessment of Test Type MATLAB Code to check the figure the student's code has created. I can easily check that using Matlab code similar to the following
% Get the handles of all subplots
axis_handles = findobj(gcf, 'type', 'axes');
% see if the title matches the requirement
set_required_title = false;
for axnum=1:length(axis_handles)
title_str = get(get(axis_handles(axnum),'Title'),'String');
set_required_title = set_required_title | strcmpi(title_str,'Oscillating Motion');
end
How do I return that result (the variable set_required_title) as an assessment test?
BTW, just for context of what I am talking about, in my LMS, this looks like

채택된 답변

Dyuman Joshi
Dyuman Joshi 2024년 4월 4일 8:03
편집: Dyuman Joshi 2024년 4월 4일 8:05
You can use assert to check a condition (whether the title contains a particular text or not) and throw a (custom defined) error (like the one you have written - with subplot number added if you want to provide a specific error) when the condition is not satisfied.
  댓글 수: 5
Dyuman Joshi
Dyuman Joshi 2024년 4월 4일 9:56
It's linked to that page, yes.
As for on example, you can check the documentation page of assert, but thpse are not in the context of use in MATLAB Grader.
I can help you write one, if you could copy and paste the code you have posted in the image.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Cris LaPierre
Cris LaPierre 2024년 4월 4일 12:39
편집: Cris LaPierre 2024년 4월 8일 12:47
Your assessment must return an error if the answer is incorrect. Otherwise, it is considered correct. This is what assert, as well as the built-in assessment functions do.
  댓글 수: 2
Cris LaPierre
Cris LaPierre 2024년 4월 4일 12:45
Since you are grading a plot, I suggest also looking at this answer. It shows how to build a more robust custom assessment test so that students alway receive meaningful feedback.
M. E. Brokowski
M. E. Brokowski 2024년 4월 7일 17:09
Interesting. I had figured out how to check various things in the learner's figure. But, I did not know that the reference plot is closed/unavailable when the assessment test script runs.

댓글을 달려면 로그인하십시오.

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by