Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

assessFunctionPresence

检查提交的答案中是否存在特定函数或关键字

说明

示例

assessFunctionPresence(mustUseFunctions) 检查基于脚本的答案中是否存在指定列表 mustUseFunctions 中的函数或关键字。如果提交的答案中不包含列出的一个或多个函数或关键字,则学生会收到一条默认反馈消息:

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

如果答案不满足评判项目中的条件,assessFunctionPresence(mustUseFunctions,'Feedback',learnerFeedback) 可帮助您向学生显示具体反馈。此语法适用于基于脚本的习题。

assessFunctionPresence(mustUseFunctions,'FileName',fileName) 检查基于函数的答案中是否存在指定列表 mustUseFunctions 中的函数或关键字。您必须提供函数名称。如果提交的答案中不包含列出的一个或多个函数或关键字,则学生会收到一条默认反馈消息:

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

如果答案不满足评判项目中的条件,assessFunctionPresence(mustUseFunctions,'FileName',fileName,'Feedback',learnerFeedback) 可帮助您向学生显示具体反馈。此语法适用于基于函数的习题。您必须提供函数名称。

示例

全部折叠

评判基于脚本的学生答案中是否存在指定函数。

assessFunctionPresence('trapz')

如果此函数缺失,则学生会收到以下默认消息:

The submission must contain the following functions or keywords: trapz

评判学生答案中是否存在指定函数。如果缺失此函数,则显示自定义反馈消息。

assessFunctionPresence('trapz','Feedback','Consult the trapz doc page if you need help using this function.')

例如,如果函数 trapz 缺失,则学生会收到以下默认消息以及 learnerFeedback 指定的自定义反馈:

The submission must contain the following functions or keywords: trapz

Consult the trapz doc page if you need help using this function.

评判基于脚本的学生答案中是否存在指定函数和关键字。如果缺失任何函数或关键字,则显示默认反馈消息。

assessFunctionPresence({'round','while'})

例如,如果函数 round 缺失,即使存在 while,学生仍会收到以下默认消息:

The submission must contain the following functions or keywords: round

评判基于函数的习题类型的学生答案中是否存在指定函数。

assessFunctionPresence('trapz','FileName','numInteg.m')

如果此函数缺失,则学生会收到以下默认消息:

The submission must contain the following functions or keywords: trapz

输入参数

全部折叠

提交的答案中需要包含的一个或多个函数或关键字列表。对于单个函数或关键字,请将此值指定为字符数组。对于多个函数或关键字,请将此值指定为一系列包含在花括号 {} 内的字符数组,并以逗号分隔。

示例: {'for','mean','diff'}

包含要测试的函数答案的文件,指定为以逗号分隔的 Name,Value 对组,该对组由 'FileName' 和包含答案文件名称的字符数组组成。

对于脚本答案,自动评分工具会使用默认文件名称 solution.m,您无需指定此参数。

示例: 'FileName','myTest.m'

向学生显示的额外反馈,指定为以逗号分隔的 Name,Value 对组,该对组由 'Feedback' 和包含向学生显示的消息的字符数组组成。

例如,假设学生并未使用习题说明中指定的 ode45 函数。您可以指导学生查看有关此函数的文档。

assessFunctionPresence('ode45','Feedback','Refer to the documentation for ode45 to understand why it is used to solve this problem.')

如果学生答案中不包含所需函数,则 assessFunctionPresence 会返回以下消息:

The submission must contain the following functions or keywords: ode45

Refer to the documentation for ode45 to understand why it is used to solve this problem.

只允许使用单个自定义反馈字符数组。如果您要检查多个函数或关键字,则自定义反馈应该与所有函数和关键字相关。

示例: 'Feedback','Review the handout on numeric integration.'

版本历史记录

在 R2016a 中推出