How to do better commenting in Matlab script?
23 次查看(过去 30 天)
显示 更早的评论
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 个评论
Jim
2017-6-19
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.
回答(2 个)
Ken Atwell
2015-6-13
You'll get to the settings you need under "Home -> Preferences -> Editor/Debugger -> Display" and "Home -> Preferences -> Editor/Debugger -> Language"
3 个评论
Image Analyst
2015-6-13
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
2015-6-14
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
2015-6-13
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!