Matlab 2018a Editor no longer showing code sections

5 views (last 30 days)
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

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!