I am getting the following error

Error in solution: Line: 55 Column: 1
Illegal use of reserved keyword "end".

Answers (2)

Matt J
Matt J on 24 Oct 2025
Edited: Matt J on 24 Oct 2025
There are many ways to generate that error. One of them is that you may be using 'end' as the name of a variable, e.g.,
end=1
Illegal use of reserved keyword "end".
Most likely, you have one too many end statements
I recommend using the editor facility "Smart Indent", which I believe has shortcut alt-i (⌘-I on Mac)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Release

R2024b

Asked:

on 24 Oct 2025

Answered:

on 24 Oct 2025

Community Treasure Hunt

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

Start Hunting!