Bug in grader of MATLAB Onramp
Show older comments
I am learning matlab using your onramp. There is a problem with the grader on Project - Stellar Motion, task 1
The task is to make a lambda vector containing measured wavelenghts. I couldn't get the grader to accept my solution.
I didn't know if perhaps it wanted a row vector or a column vector so I tried both. I could see that the numbers looked correct but the grader rejected both my attempts. Here is the column version
lambda = [];
lambdaEnd = lambdaStart + (nObs-1)*lambdaDelta;
for n=1:nObs
lambda(n,1) =lambdaStart + (n-1)*lambdaDelta;
end
According to the Hint, it should be correct. Finally I gave up and asked for the answer.
The accepted answer is very concise, quite beyond my current knowledge:
lambdaEnd = lambdaStart + (nObs-1)*lambdaDelta
lambda = (lambdaStart:lambdaDelta:lambdaEnd)
I tried it and the grader was happy. The values are idenitcal to what I had been getting both as a row or column vector.
The problem is the grader won't accept anything besides the single solution it is expecting. This looks to me a bit too rigid.
12 Comments
Dyuman Joshi
on 24 Jul 2023
Can you copy and paste the full problem statement? The question could have possibly asked for a vectorized solution.
Ilan Tal
on 24 Jul 2023
Ilan Tal
on 24 Jul 2023
Cris LaPierre
on 24 Jul 2023
"The accepted answer is very concise, quite beyond my current knowledge:"
Please revisit Ch 4.2 (Vectors and Matrices > Creating Evenly-Spaced Vectors) of MATLAB Onramp, where you were taught 2 ways to create vectors: using the colon operator, and using linspace.
Petra
on 9 Apr 2024
Having the same issues with this. Also can't name the xlabel ("Wavelength") as an error comes up saying it is both a function and a variable, which is true, but is also what the solution states, so seems to be an incompatible answer with the grader.
Image Analyst
on 9 Apr 2024
@Petra what was your code? You forgot to include it. Was it like this working solution?
lambdaEnd = lambdaStart + (nObs-1)*lambdaDelta
lambda = (lambdaStart:lambdaDelta:lambdaEnd)
or did you do something else? Did you see @Cris LaPierre answer below? What was your starting value?
Can you show how the solution used used xlabel both as a solution and as a variable name? I would not think it would do that? Are you sure there is not some capitalization difference?
Petra
on 9 Apr 2024
Project - Stellar Motion
Instructions are in the task pane to the left. Complete and submit each task one at a time.
This code loads the data and defines measurement parameters.
load starData
nObs = size(spectra,1)
lambdaStart = 630.02
lambdaDelta = 0.14
Task 1
lambdaEnd = lambdaStart + (nObs-1)*lambdaDelta
lambda = (lambdaStart:lambdaDelta:lambdaEnd)
Task 2 & 7
s = spectra(:,6)
Task 3
plot(lambda, s, ".-")
xlabel("Wavelength")
ylabel("Intensity")
Task 4
Task 5
Task 6
Further Practice
Petra
on 9 Apr 2024
Omg, I fixed it just by adding the semicolon to the end of line 1 in task 3 facepalm
Cris LaPierre
on 9 Apr 2024
Edited: Cris LaPierre
on 9 Apr 2024
That's odd. A semicolon should not have any impact on the grading here. Can you please share a full screenshot of the task with your code that causes the error and the error message displayed?
Please also mention what browser your are using and what version of the course you are taking (look in the url for "/R202__/".)
Socrates Jr
on 5 Mar 2025
For task 3, I was having the same error: "xlabel appears to be both a function and a variable. If this is unintentional, use 'clear xlabel' to remove the variable"
I just followed the error suggestion. Here is mine:
clear xlabel
clear ylabel
plot(lambda, s, ".-")
xlabel("Wavelength")
ylabel("Intensity")
I copied your same code for task 3.It still appears incorrect after submitting in my system.

Cris LaPierre
on 9 Mar 2026
There is an error preventing the assessment tests from running to completion. When working as designed, if an answer is incorrect, there is also feedback on what is incorrect. For example:

Try resetting the problem (hyperlink next to Hint | See Solution)
You could also try exiting the course and then signing back in.
Accepted Answer
More Answers (2)
Image Analyst
on 24 Jul 2023
Evidently it wanted you to use the vectorized way of creating the vector :
vec = startingValue : incrementValue : finalValue
Was that the concept it had just trained you in? If so, and you didn't use that and used a for loop instead, it might think you didn't understand what it just taught you.
Petra
on 9 Apr 2024
0 votes
ADDITIONAL BUG FOUND IN MATLAB ONRAMP GRADER
At https://matlabacademy.mathworks.com/R2023b/portal.html?course=gettingstarted#chapter=13&lesson=2§ion=1 Tasks 2-4 the final solution doesn't work even though it's the answer.
This and the above task are mitigating course completion
Categories
Find more on Use Content in an LMS Course 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!