MATLAB: Comments line change automatically

commentline changere-align

The code I was given has lots of comments without enter. Comment length is over my laptop monitor size so I have to use horizontal scroll bar.
Is there any clever way to line change and re-align comments not to use horizontal scroll bar?
Thank you.

Best Answer

If you look in the editor preferences, you will see that you can force the editor to wrap comments at some column number, that can be set by you. (The default was 75 columns as I recall.)
So I think the best you can do is to simply add a space, to the end of such a run-on comment line. The editor will then automatically wrap the line. If the line was so long that it would wrap to 5 or 10 lines, you will need to add multiple spaces, since adding one space will simply pull off the first 75 characters from that line. The editor will look for spaces to break the line, so it won't break a long word.
So, while this is not a great solution, I think it is your only option. At least you need only do this once, then save the offending file, with now readable comments.