section divider or %% is not working
43 ビュー (過去 30 日間)
古いコメントを表示
I solved several small problems in sections using section divider %% Section. I ran each sections & every section worked. Today I opened the file, %% Sections are there, but section dividers are not working. How to correct the situation. Thanks Abu Sarwar
1 件のコメント
採用された回答
Stephen23
2017 年 1 月 8 日
編集済み: Stephen23
2017 年 1 月 8 日
Cell mode can be enabled or disabled from the Cell menu.
Different versions of MATLAB might put this in different places, but on my ancient R2010b it is located on the main editor menu bar:

1 件のコメント
Jiangdong Collignon
2021 年 5 月 7 日
In MATLAB R2018b, you go to tab HOME -> Preferences -> Editor/Debugger -> Autoformatting and then you tick the boxes in section break.
Personally, I had it on and the it still didn't work but I found out why : I put my function at the beginning of my script by accident so from that section, I couldn't split the script into sections with %%. Just put your function at the end of your script and it maybe it'll work for you too :)
その他の回答 (5 件)
DGM
2023 年 5 月 5 日
編集済み: DGM
2023 年 5 月 5 日
It's also worth noting that having open scopes, imbalanced parentheses/brackets, or other gross errors can break the handling of section breaks. It's a bit moot, since invalid code won't run anyway, but that might be one reason your section highlighting suddenly stops working.
A = [1 2 3; % this is an error
%% oh no my cell divider doesn't work!
B = 12.34; % some other code
0 件のコメント
the cyclist
2017 年 1 月 8 日
Did you try simple things like saving and re-opening the file, or restarting MATLAB?
Image Analyst
2017 年 1 月 8 日
編集済み: Image Analyst
2023 年 5 月 5 日
And how did you try to execute it? Did you use the green Run triangle or F5, OR did you try Step or F10? Which way? Using F5 will just blast through everything without stopping at cells whereas F10 will stop at cells.
Also make sure the Section Break checkboxes are checked in the Autoformatting preferences:

Megan Yip
2021 年 1 月 20 日
移動済み: Image Analyst
2023 年 5 月 5 日
For anyone eldr who had this problem, make sure that if you have text after the %%, that you have a space between the second % and the first text character. For example, use
%% Section Name
which will work, rather than
%%Section Name
which won't work.
0 件のコメント
GANDI RAVIKUMAR
2023 年 5 月 4 日
May be below is the one of the reason..
Check your file name with which you have saved.
File name should not have any spaces, if it contains any spaces just rename it and remove spaces then it might work.
Check once.
Thank you...!!!!1
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Performance and Memory についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!