checking for colon operator in MATLAB grader
이전 댓글 표시
In the very first part of a course, I want to check that students are using the colon operator to create a simple vector. I've tried the following:
assessFunctionPresence(:)
assessFunctionPresence(':')
but neither seem to work.
Does anyone know if this can be done, and if so, how?
댓글 수: 3
Have you tried this?
assessFunctionPresence('colon')
I'm not familiar with MATLAB grader, so I can't say for sure that will work, but colon is the colon operator:
colon(1,5)
James Wiles
2023년 9월 21일
Dyuman Joshi
2023년 9월 21일
You can try using assert()
답변 (1개)
Cris LaPierre
2023년 9월 21일
편집: Cris LaPierre
2023년 9월 21일
0 개 추천
MATLAB Grader does not have a built-in way to check for the use of operators (see this related question).
You might try combining the assessment of their variable values with banning the use of other matrix creation functions (e.g. linspace).
Consider looking at the Vector Creation (creating equally spaced vectors) sample problem in Sample Problems From MathWorks > Introduction to Programming > Matrices & Operators. It's the 2nd problem.
댓글 수: 2
James Wiles
2023년 9월 21일
Cris LaPierre
2023년 9월 21일
If you don't yet have access to the full catalog of sample problems, please reach out to your Mathworks representative. Access is limited to verified instructors.
카테고리
도움말 센터 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!