Main Content

assessFunctionAbsence

Check that certain functions or keywords are not present in the learner solution

Description

assessFunctionAbsence(disAllowedFunctions) checks that the specific functions or keywords listed in disAllowedFunctions are not present in the submission of a script-type solution. If the submission does contain one or more of the functions or keywords listed, the learner receives a default feedback message:

The submission must not contain the following functions or keywords: <name1>, <name2>, ...<namen>

assessFunctionAbsence(disAllowedFunctions,'Feedback',learnerFeedback) lets you display specific feedback to the learner if the solution does not pass the conditions in the assessment test. Use this syntax for script-type problems.

assessFunctionAbsence(disAllowedFunctions,'FileName',fileName) checks that the specific functions or keywords listed in disAllowedFunctions are not present in the submission of a function-type solution. If the submission does contain one or more of the functions or keywords listed, the learner receives a default feedback message:

The submission must not contain the following functions or keywords: <name1>, <name2>, ...<namen>

assessFunctionAbsence(disAllowedFunctions,'FileName',fileName,'Feedback',learnerFeedback) lets you display specific feedback to the learner if the solution does not pass the conditions in the assessment test. Use this syntax for function-type problems. You must provide the function name.

example

Examples

collapse all

Assess whether the disallowed keyword is present in the learner submission of a script-type solution.

Check for presence of keyword case. If the keyword is present, the learner receives a default message.

assessFunctionAbsence('case')
The submission must not contain the following functions or keywords: case

Assess whether the disallowed function is present in the learner submission for a function-type solution.

Check for the presence of function trapz. Show a customized feedback message if the learner solution contains the function.

assessFunctionAbsence('trapz','FileName','extractFreq.m','Feedback', 'Your implementation of the trapezoid rule cannot use built-in MATLAB functions.')
The submission must not contain the following functions or keywords: trapz
Your implementation of the trapezoid rule cannot use built-in MATLAB functions.

Assess whether disallowed functions and keywords are present in a learner submission of a function-type solution.

Check for presence of disallowed functions and keywords cos and for. If these items are present, the learner receives a default message.

assessFunctionAbsence({'cos','for'},'FileName','myFunction.m')

For example, if only the keyword for is present, the learner receives this default message:

The submission must not contain the following functions or keywords: for

Assess whether the disallowed keyword is present in the learner submission of a function-type solution.

Check for presence of keyword case. If the keyword is present, the learner receives a default message.

assessFunctionAbsence('case','FileName','myFunction.m')
The submission must not contain the following functions or keywords: case

Input Arguments

collapse all

A list of one or more functions or keywords that must not be in the learner solution. For a single function or keyword, this value is specified as a character array. For multiple functions or keywords, this value is specified as a comma-delimited series of character arrays within curly braces { }.

Example: {'for', 'fft'}

File that contains the function solution to be tested, specified as the comma-separated Name,Value pair consisting of 'FileName' and a character array containing the solution name.

For scripts, the auto-grading tool uses the default file name solution.m, and you do not need to specify this argument.

Additional feedback to display to the learner, specified as the comma-separated Name,Value pair consisting of 'Feedback' and a character array containing a message to the learner.

For example, assume the learner used the disallowed keyword for. You could direct the learner to the correct study module for this problem.

assessFunctionAbsence('for','Feedback','Refer to handout on code vectorization.')

If the learner solution contains the disallowed function, assessFunctionAbsence returns the following message:

The submission must not contain the following functions or keywords: for
Refer to handout on code vectorization.

Only a single, customized feedback character array is allowed. If you are checking for more than one function or keyword, make the custom feedback relevant to all the functions and keywords.

Example: 'Feedback','See the handout from March 15, Using Case Statements'

Version History

Introduced in R2016a