필터 지우기
필터 지우기

How to make section folding have an extra space (empty lines) between sections?

조회 수: 3 (최근 30일)
Hello,
in previous MATLAB versions (e.g 2015) you could introduce empty lines to make spaces between sections once they are folded? (so they won't be "sticked" so closed together).
Section was actually defined from %% till the last line of code in it (a=1, in the example below).
In MATLAB 2021b, section defined from %% till the begining of next section. So, when sections are folded, they look too close to each other. If I have many sections, each one with a unique title, once folded, it's a bit difficult to read.
I'm introducing an additional %% line, but it looks very un-natural and a bit weird work-around.
Is there any other solution to that?
THANKS

채택된 답변

Srija Kethiri
Srija Kethiri 2022년 2월 16일
Hi Mark,
This feature of having blank lines between the sections is possible only till R2021a and there does not seem to be any option or parameter that can be set to go back to the behavior of retaining the blank lines between sections.
More information related to code folding and options associated with it can be found here.
There is no obvious workaround for this code formatting issue, but you can restore it by creating fake blank sections to make the code more readable:
%% Section 1
%%
%% Section 2
Hope this helps.
  댓글 수: 1
Craig
Craig 2023년 2월 6일
I would call this a "bug" (or perhaps a slightly less strong word). At least there should be an option, or a work around.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Avery
Avery 2024년 2월 21일
I second this topic. Being able to include blank lines between sections really helps organize different parts of my code. I would love if blank lines could be preserved in an upcoming revision of the editor.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by