Word wrap in MATLAB editor
The way to do this is by using the three dots ...
For example:
Hc_frame_1 = uicontrol(gcf, ...
'Style', 'frame',...
'Units', 'pixels',...
'Position', [25 250 200 230]);
These three dots tell MATLAB to continue the command on the next line. Without them MATLAB will think that the command is incomplete.
Gnubie
Updated on June 04, 2022Comments
-
Gnubie almost 2 years
How can I word-wrap long lines of scripts and functions in the MATLAB R2011b Editor?
I don't mean using Ctrl+J to wrap comments, but show a long line over several lines, each (except the last) the width of the editor frame, as in most text editors, so I don't need to scroll horizontally; the effect is purely visual and it remains as a single line in the file.
I could not find a setting in any menu, toolbar or the preferences dialog.
Though I could split the line into multiple lines using "...", I don't want to do this. I want to keep it as one line in the file, just show it wrapped, as in Format > Word Wrap in Windows Notepad.
-
Gnubie almost 12 yearsSorry, I don't want to split a logical line physically into different parts. I want to keep it as one line in the script, but just display it in the editor wrapped, similar to Format > Word Wrap in Windows Notepad.
-
Dang Khoa almost 12 years@Gnubie - have you stopped to consider why you need this functionality in the first place? If you've got consistently long lines that need wrapping, you should probably be refactoring a little to make those lines less long.
-
Gnubie almost 12 years(1) I've inherited many long scripts, so it's too much trouble fixing long lines. (2) It lets me quickly comment out and uncomment lines using Ctrl-R and Ctrl-T, respectively, during debugging. With blocks, one must select the entire block, making sure no more or fewer lines are selected.
-
Carl Witthoft almost 9 yearsI want this functionality too, if for no other reason that sometimes I have limited screen space and would like to be able to read code in, say, a 40-char-wide window. hard-wrapping via
...
is total bogosity. -
cladelpino over 4 yearsVery old related: superuser.com/questions/327497/…