MATLAB graders issues, i want to use one funtion from another problem

19 views (last 30 days)
I am using MATLAB graders. In some assignments we want students to write a function which they will use in a following script. I can see where to add the functions file, but can't find it to include.

Accepted Answer

Cris LaPierre
Cris LaPierre on 18 Feb 2024
Edited: Cris LaPierre on 18 Feb 2024
Each problem in MATLAB Grader is independent of the other problems. You can add external files to a problem for learners to use in their solutionk but it is not possible to link to their solution from a different problem.
I think the most robust approach here would be to have the students still write the function in one problem, but when it comes time to use the function in this problem, I would attach a p-coded function file. That way, the problem about the function can focus on assessing the function, and the problem that uses the function can focus on if it is used correctly knowing that the attached function file works correctly. This also allows learners who can't figure out how to create the function correctly to move on with the assignment.
If you truly want them to use their version of the function, then the only solution is to have your learners copy their function code and paste it in the new problem at the bottom of the script as a local funcion. See here.

More Answers (0)


Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!