Definitely a newbie. When entering functions at the command line, how do I go back to lines above and correct syntax errors??

Definitely a newbie. When entering functions at the command line, how do I go back to lines above and correct syntax errors??

 Accepted Answer

You can't go back and "correct" what has already been run. Think of the text in the command window as being a record of what you have done, not as code to be edited. That text simply shows what you have already done. If you want editable code then write scripts or functions.
Of course you can use the arrow keys to scroll through the commands that you have run, then select any to run them again. You can also clear the command window using clc (there is a button somewhere too...). But the command window is not editable code!
This is not just a MATLAB thing, many IDE's / consoles / command windows work in the same way: they act as a record of your work, not as a place to write code and edit it. That is what the MATLAB editor is for!
Learn to write functions:

More Answers (0)

Categories

Find more on Get Started with MATLAB 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!