How to do better commenting in Matlab script?
23 views (last 30 days)
Show older comments
When I am trying to comment long sentence in script, it unnecessarily to next line. But, I want to continue in the same line. Probably, that's because of grey shaded line as shown in figure. How to move this vertical line, or slide it in a place where I want. Thanks
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/151135/image.png)
6 Comments
Jim
on 19 Jun 2017
Click anywhere inside the comment and hit ctrl-J. This will force the comment to wrap to the margins. This is one of my favorite keyboard shortcuts.
Automatic wrapping of long comments as you type them has always seemed hit-or-miss; sometimes it works, other times not so much.
Answers (2)
Ken Atwell
on 13 Jun 2015
You'll get to the settings you need under "Home -> Preferences -> Editor/Debugger -> Display" and "Home -> Preferences -> Editor/Debugger -> Language"
3 Comments
Image Analyst
on 13 Jun 2015
It's been there a while. But the confusing part is that it's really in two places in the preferences. You also have to look in the Language screen:
 
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/182862/image.jpeg)
 
Set it high here if you want to manually control your own line wrapping. I set my values high on both screens because I want to control my own wrapping (sick of having comments with only one word on the second line and then having to manually delete end of line and comment symbol to make it all on one line.) dpb, you might try setting the value on this screen as well as the display screen to achieve whatever you want.
dpb
on 14 Jun 2015
Yeah, I found that in research the question -- the thing I discovered is and was wondering about is that it is still at the (I presume default?) column 75 and the language section "Wrap" box is checked but I still see no automagic (and like you, that would be undesirable behavior) wrapping occurring; hence
- I'd never noticed it; the line is so faint as to be indiscernible unless I really look for it so actually hadn't ever noticed it was actually there and
- thus the query about whether it is/was simply a nonfunctioning function yet to be implemented in R2012b but for which the UI hooks had been implemented. Although this seems not likely as I see on looking that R14, the latest previous release prior to R2012b installed, has the same options so it's been around a while.
So, I'm still confused as to the behavior -- I'm happy it doesn't futz with my files but curious as to why not given the settings as are...
Which reminds me of my earlier query that got no response on file extensions and language support...
Customization of editor: Add a language and or extension which puzzled me greatly that nobody had even a comment on the subject, what more an answer...
Mischa Kim
on 13 Jun 2015
Tanmoy, (in R2015a) go to Preferences > Editor/Debugger > Display. In the Right-hand text limit section you can remove that line or move it to wherever you want using the Placement field.
0 Comments
See Also
Categories
Find more on Environment and Settings 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!