MATLAB Grader: Learner solution.m missing? No such file or directory.

I have used custom code many times to check my learners have written something exact, e.g.
% Get student code
soln = fileread('solution.m')
% Remove white spaces to standardise
NoSpacesSoln = regexprep(soln,'\s+','');
% check for v(k) defined with various spacings
CheckVk = contains(NoSpacesSoln,'v(k)=')
Today, when selecting Validate Reference Solution or Learner Preview, I get:
Error using fileread (line 23) Could not open file solution.m. No such file or directory.
Using ls I see only SolutionTest.m in both cases too. This file appears to contain:
%% ScoringEngineTestPoint1
%% ScoringEngineTestPoint2
%% ScoringEngineTestPoint3
I went back to an older problem set my students are using, and this exact code:
soln = fileread('solution.m')
works fine to get the student solution.
Any idea what’s happening?

 採用された回答

Cris LaPierre
Cris LaPierre 2021 年 11 月 5 日

0 投票

I can get the same error message if I try to use fileread('solution.m') on a function type problem.
Note that for function type problems, the file name is the same as the function name. Only script-type problems are saved in grader with the name 'solution.m'.

1 件のコメント

IFM
IFM 2021 年 11 月 8 日
Make sense. I don't often make function type problems so that one slipped my mind!
Brilliant, thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

リリース

R2021b

タグ

質問済み:

IFM
2021 年 11 月 5 日

コメント済み:

IFM
2021 年 11 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by