kojikurac
kojikurac

Reputation: 205

Formatting code nicely

Extremely simple question: how can I format my code to be nicely readable. Example:

A = (B+C+D+E+F+G+H+I+J+K...)

and let's say it is so long that I have to scroll for ages to later see what I wrote. If however I press enter to separate the line like this:

A = (B+C+D+E
+F+G+H+I...)

matlab reports error

Thanks

Upvotes: 5

Views: 169

Answers (3)

Sir Eisenhower
Sir Eisenhower

Reputation: 251

You're looking for "line continuation".

http://www.mathworks.com/help/techdoc/matlab_env/f0-5789.html#f0-5857

Upvotes: 1

Peter K.
Peter K.

Reputation: 8108

Use ... at the line break. It is a line continuation.

Upvotes: 6

Chris Gregg
Chris Gregg

Reputation: 2382

Use ... to split lines:

Instead of a = x + y + z, you can use:

a = x ...
+ y...
+ z

Upvotes: 6

Related Questions