How to do better commenting in Matlab script?

조회 수: 40 (최근 30일)
Tanmoy 2015년 6월 13일
댓글: Jim 2017년 6월 19일
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
  댓글 수: 6
dpb 2015년 6월 13일
Of course one can (^+ is simpler)
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
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
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:
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
  1. 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
  2. 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
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.


Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by