Create Subparts in one problem on MATLAB grader

2 ビュー (過去 30 日間)
Shruthi Srinivasan
Shruthi Srinivasan 2024 年 1 月 20 日
コメント済み: Dyuman Joshi 2024 年 1 月 22 日
Is it possible to create multiple subparts under one problem in MATLAB grader? If so how can we do it?
  3 件のコメント
Cris LaPierre
Cris LaPierre 2024 年 1 月 20 日
編集済み: Cris LaPierre 2024 年 1 月 20 日
Could you please clarify what you mean by 'subparts'? What would this look like, and what would be the reason for doing this?
Shruthi Srinivasan
Shruthi Srinivasan 2024 年 1 月 20 日
編集済み: Shruthi Srinivasan 2024 年 1 月 20 日
To provide more clarity, Say there are three questions, one question deals with solving for hypotenuse, other the problem the adjacent side and the third the opposite side. Can I have three questions under one problem?

サインインしてコメントする。

回答 (1 件)

Dyuman Joshi
Dyuman Joshi 2024 年 1 月 20 日
編集済み: Dyuman Joshi 2024 年 1 月 20 日
Yes, in addition to tests provided by the MATLAB Grader, you can include your custom assessments. See the documentation for
> Function based problems -
> Script based problems -
Here is an example of custom test case using assert -
out = zeros(3,4,'uint8');
%%
%Check for data-type of the output
assert(isa(out, 'uint8'), 'The output must be a Unsigned 8-bit integer array')
%%
%Check for size of the output
assert(isequal(size(out), [3 4]), 'The output must be of size [3 4]')
%%
%Check for values of the output
assert(isequal(out, ones(3,4,'uint8')), 'The obtained output is not correct')
Error using assert
The obtained output is not correct
In case, there are multiple cases for which you want to check you can club them together as well -
%Let fun be the function where the code is written
%%
out1 = fun(in1);
assert(isa(out1, 'uint8'), 'The output must be a Unsigned 8-bit integer array')
assert(isequal(size(out1), [3 4]), 'The output must be of size [3 4]')
assert(isequal(out1, ones(3,4,'uint8')), 'The obtained output is not correct')
%%
out2 = fun(in2);
assert(isa(out2, 'uint8'), 'The output must be a Unsigned 8-bit integer array')
assert(isequal(size(out2), [6 6]), 'The output must be of size [6 6]')
assert(isequal(out1, uint8(magic(6))), 'The obtained output is not correct')
  4 件のコメント
Shruthi Srinivasan
Shruthi Srinivasan 2024 年 1 月 20 日
I see, Just a follow up question, say a folder has 2 problems can we automatically incorporate Canvas to cummulatively grade the folder rather than assigning individual grades to the problems?
Dyuman Joshi
Dyuman Joshi 2024 年 1 月 22 日
I am not familiar with Canvas, however based on this particular video it seems you can put the questions together in a group and MATLAB Grader will automatically grade it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeUse Content in an LMS Course についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by