Matlab 2018a Editor no longer showing code sections

5 ビュー (過去 30 日間)
Blake Porter
Blake Porter 2019 年 6 月 18 日
コメント済み: Blake Porter 2021 年 10 月 9 日
With no apparent cause, my Matlab editor stopped showing section breaks and cannot "Run Section" anymore as a result. This is only happens for one script (and the most recent versions of it). I have older versions of it with minor changes which do not have this section issue. Using the Compare tool with the "working-section" scripts to the latest versions where sections don't appear shows no obvious cause. This happens for the same scripts on multiple computers (Windows 10 machines). It is a relatively large script (4,000 lines). I've tried restarting Matlab and my computers. I've tried re-saving the Script. Autoformatting has section breaks ticked.
Other Matlab users report this can be due to an error in the code but there is no error in the code and the script runs just fine.
Edit: Since other scripts work fine I opened a new script, select all non working code and pasted. Did not work. Then I took the first half of my code, pasted it into a new script. Sections work. Added second half, stop working. New Script. Second half, works. New Script, first half, works. Start adding second half section by section. Work up until I get to this bit of code:
%% Plot each subjects's break attempts for each session
[breakSortAtt, breakSortAttIdx] = sort(out.(groups{currG}).breakAttempts);
allRatNames_breakSortAtt = out.(groups{currG}).ratID(breakSortAttIdx);
figure;
hold on
for i = 1:length(allRatNames)
plot(-1:0,'color',cmap(i,:),'linewidth',7);
end
legNames = [allRatNames; {'avg'}];
line([0 length(out.(groups{currG}).breakAttempts)]+1, [avgBreakAtt_all avgBreakAtt_all],'LineStyle','--','color',[0.5 0.5 0.5])
legend(legNames,'Location','northwest');
b = bar(breakSortAtt,1,'FaceColor','flat');
legend(legNames);
for i = 1:length(allRatNames)
currRat = allRatNames{i};
indexRats = strfind(allRatNames_breakSortAtt,currRat);
index = find(not(cellfun('isempty',indexRats)));
for j = 1:length(index)
b.CData(index(j),:) = cmap(i,:);
end
end
hold off
ylim([0 max(breakSortAtt)+5]);
ylabel('Quit attempts #');
title(groups{currG});
xticklabels([]);
up until and with this section of code I can paste in new sections of code and sections work. After this bit of code I can still create new sections. However, if I paste in some sections of code from the non-working script, Sections seems to stil work fine. However, if I paste multiple other sections of code, Sections will stop working. New pasted in sections are not recgonzied and I can't manually add in new sections. However! If I delete some white space/empty lines, Sections will come back, sort of, but then adding further code will break it again.
testingSections.png
testingSections2.png
  2 件のコメント
Iñigo Martinez
Iñigo Martinez 2021 年 10 月 8 日
I have the same bug! :( Did you find the solution?
Blake Porter
Blake Porter 2021 年 10 月 9 日
No :/

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by