Section color no longer an option in 2021b?

293 views (last 30 days)
Cory Dinkle
Cory Dinkle on 19 Oct 2021
Commented: Steven Lord on 9 May 2022 at 18:10
Prior to the changeover (versions 2021a and older), the current section in the Editor would be highlighted a yellowish color. Now with 2021b, there is a blue bar on the left to indicate the current section. I'd like the yellow-highlighted color back. Looking at the forum, there was an option in Preferences -> Colors -> Programming Tools that would allow the user to customize this section color, but unfortunately this has been removed. Or am I not seeing it somewhere?
Simeon Yurek
Simeon Yurek on 21 Jan 2022
Is it possible to turn off the section highlight/blue line feature in 2021b while still keeping section breaks? Thanks!

Sign in to comment.

Accepted Answer

Arthi Sathyamurthi
Arthi Sathyamurthi on 26 Oct 2021
Starting in R2021b, sections in the Editor have an improve appearance. The new section is highlighted with a blue border, indicating that it is selected. Hence, "section display option" to highlight section is not available in R2021b.
For more information refer to R2021b Release Notes (Environment --> Editor Sections).
Steven Lord
Steven Lord on 9 May 2022 at 18:10
I love that the font on the line that starts with %% is in bold face. It allows me to give a hierarchy to comments.
FYI you can change the text (not comments in code sections) in the Live Editor into different heading levels. MATLAB Answers has similar functionality, though it only offers "Heading" rather than "Heading 1", "Heading 2", and "Heading 3" as is available in the Live Editor. In Answers click the icon to the left of the B icon in the Text section of the Toolstrip. As an example:
Here is a heading!
In the Live Editor select the Live Editor tab and click the icon "normal" in the Text section of that tab to change the heading level. These headings are reflected by different indentation levels in the Table of Contents (which you can add to your Live Script via the Insert tab.)

Sign in to comment.

More Answers (11)

Marcel on 10 Nov 2021
@Arthi Sathyamurthi why does the Blue bar on the left side sometimes not appear?
It seems that the section bar is not available, if a .m file is a function instead of a script?
Personally I agree with @Cory Dinkle, that "improved appearance" is very subjetive and I feel a big downside on the new layout...
Bob on 16 Feb 2022
In MATLAB, I exclusively program with only functions and classes. I find scripts limiting because they junk up the base workspace with variables. If I want to work with these variables at the command line, I simply use breakpoints to enter the debugger. So, this new design restriction on section highlighting artificially limits the section highlighting capability for me.
I vastly prefer the old style in which the background is highlighted in a color to the new blue bar. One way that I enjoyed using section highlighting was to help visually break up multiple local functions and nested functions within a single m-file. In fact, for GUIs with more than a handful of controls, I would say this highlighting capability is almost critical for me. If the old style was brought back to the Editor, or added as a new feature for the use case that I described, it would be greatly appreciated!
(Also, where is the capability in the MATLAB Editor to group multiple files under projects whose contents can be collapsed and expanded? I develop code for multiple tasks, and this feature would enormously aid in helping to organize my work. I have been waiting over 20 years for this capability to be added to the Editor...)

Sign in to comment.

Marcel on 28 Jan 2022
I like to address another problem of a non-highlighted section @MathWorks Support Team:
It is not possible to see where the line start, where is character 1. The current editor looks like there are 3-4 free space before the first letter, so the entire line looks intended, even if it's not. With the (yellow) highlight in the picutre below from 2021a it was clearly visibly where the first character of this line is.
MATLAB 2021b
MATLAB 2021a

Andrew Marshall
Andrew Marshall on 28 Jan 2022
Yes. I would also like the yellow-ish highlighted cell mode to return. I don't like the current default.

Zhaoran Zhang
Zhaoran Zhang on 18 Feb 2022
Yeah, I also like the yellow backgroud much better. I think the yellow helps me to focus on the current section better and give me more peace. I've been working with the same yellow background for years, feeling sad to not have it anymore.
  1 Comment
Richard on 15 Mar 2022
Agreed. I think the yellow background that I had R2021a is great.... now I'm on R2022a I'm ticked off its gone.

Sign in to comment.

Marcel on 20 Jan 2022
I was checking out the 2022a pre-release, and found that there is still no option to highlight the current code section. Can you please address this user request before launching the official 2022a.
  1 Comment
David Rosenbaum
David Rosenbaum on 20 Jan 2022
Much appreciated, folks. That will help and I (we) appreciate your responsiveness ... Two more suggestions for MATLAB: (1) Provide a feature whereby all the section headers (distinguishing strings after %%) are shown as a kind of table of contents in the program and not just in the Publish version; (2) Allow for subsections down to some arbitrary number of levels as in standard hierarchicies.

Sign in to comment.

Shyam Kishor Sharma
Shyam Kishor Sharma on 20 Apr 2022 at 5:02
Yes, Recently I updated my version from 2018 to 2022a , and there is no option for yellow color in section after %% sign .I used to that features .Please bring back the previous display settings.

Ian Townend
Ian Townend on 22 Mar 2022
I have just migrated from 2020b to 2022a. All I can see on my screen to denote the current section are two horizontal blue lines. The side bar blue strip is so thin it is almost invisible. I will try adapting but may well revert to using 2020b for editing. As already stated there is a high degree of subjectivity in the statement that this change has improved the appearane. For me the ability to clearly identify the current section with a pale colored background was one of the strengths of the Matlab editor.

Naor on 4 May 2022 at 18:58
+1 that request, and also requesting the option to remove the horizontal line between sections.
Sections are valuable to me in functions (as opposed to scripts or live scripts) as a way to visually organize code, perhaps like paragraphs or chapters in prose. A subtle visuale distinction between sections is very helpful, while a strong visual distinction is more distracting than helpful.

Jakub Matousek
Jakub Matousek on 4 May 2022 at 21:27
Please give it back.

Liang Hu
Liang Hu on 6 May 2022 at 0:10
Please give this option back I am so used to it. Have to downgrade to 2021a after upgrading to 2022a. It is just a waste of time.

Martin Brand
Martin Brand on 9 May 2022 at 17:20
I would also greatly appreciate to have the yellow highlighting back, please!




Community Treasure Hunt

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

Start Hunting!