Stellar motion part 2, task 5
Afficher commentaires plus anciens
I'm doing the 5th task of Stellar motion part 2 and I keep getting it marked as wrong.
The solution to the task is
legend(starnames)
and even though I've tried a million ways of reentering it (restarting the task, writing it manually, copying and pasting the solution code), I keep getting a message telling me that "'legend' appears to be both a function and a variable". I can't keep going with the intro if this isn't accepted. Help :(
2 commentaires
VISHWANATHAN
le 24 Oct 2025
Hint
Use the legend function with one input.
If you get an error from the legend function, check for a variable named legend in the workspace. If this variable exists, clear the variable with clear legend before submitting the task.
Mohammad
le 28 Oct 2025
Plz give correct clarification sir... How can i solve..?
Réponses (3)
Cris LaPierre
le 1 Juin 2023
Modifié(e) : Cris LaPierre
le 1 Juin 2023
7 votes
It appears at some point you created a variable named legend, which has overwritten the legend function.
Try adding clear legend before you use legend(starnames)
4 commentaires
Roni
le 12 Août 2023
thank you very much
Petra
le 9 Avr 2024
Same, thanks Chris
Ivan
le 21 Déc 2024
Same here. Thanks for the clarification!
VISHWANATHAN
le 24 Oct 2025
can you give me ans
Gaurao
le 5 Mai 2025
0 votes
legend(starnames)
VISHWANATHAN
le 24 Oct 2025
0 votes
Hint
Use the legend function with one input.
If you get an error from the legend function, check for a variable named legend in the workspace. If this variable exists, clear the variable with clear legend before submitting the task.
Catégories
En savoir plus sur Legend dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!