필터 지우기
필터 지우기

[MATLAB Grader] How to test if a matrix compares.

조회 수: 1 (최근 30일)
BW
BW 2022년 6월 16일
편집: Cris LaPierre 2022년 6월 16일
I am trying to set up a test function which evaluates the matrix generated by the students code against the sample solution in MATLAB Grader.
Is there a way of doing this? The suggested:
assessVariableEqual('A', referenceVariables.A, 'RelativeTolerance', 0.1, 'AbsoluteTolerance', 0.01);
has not worked.
Cheers
  댓글 수: 5
BW
BW 2022년 6월 16일
Sorry wont be able to share, but have managed to resolve it based on your comment. Thank you greatly.
Cris LaPierre
Cris LaPierre 2022년 6월 16일
I'll move my comment to be an answer then. Thanks

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

채택된 답변

Cris LaPierre
Cris LaPierre 2022년 6월 16일
편집: Cris LaPierre 2022년 6월 16일
The code you have provided will compare the values in the student's variable A against the reference solution variable A. Values are considered equal if the value is either within +/- 10% of the reverence value OR +/- 0.01 of the reference value.
Tolerances can only be applied to numeric values, and the variable data type must be the same as the tolerance data type, or the tolerance is ignored.
Knowing that, can you explain what you mean when you say it has not worked?

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by