Stellar motion part 2, task 5

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 件のコメント

VISHWANATHAN
VISHWANATHAN 2025 年 10 月 24 日
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
Mohammad 2025 年 10 月 28 日

Plz give correct clarification sir... How can i solve..?

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

回答 (3 件)

Cris LaPierre
Cris LaPierre 2023 年 6 月 1 日
編集済み: Cris LaPierre 2023 年 6 月 1 日

7 投票

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 件のコメント

Roni
Roni 2023 年 8 月 12 日
thank you very much
Petra
Petra 2024 年 4 月 9 日
Same, thanks Chris
Ivan
Ivan 2024 年 12 月 21 日
Same here. Thanks for the clarification!
VISHWANATHAN
VISHWANATHAN 2025 年 10 月 24 日
can you give me ans

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

Gaurao
Gaurao 2025 年 5 月 5 日

0 投票

legend(starnames)
VISHWANATHAN
VISHWANATHAN 2025 年 10 月 24 日

0 投票

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.

カテゴリ

質問済み:

2023 年 6 月 1 日

コメント済み:

2025 年 10 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by