Does MATLAB2019B automatically add semicolons in m files?
조회 수: 4 (최근 30일)
이전 댓글 표시
I just updated to 2019B from 2015. I have noticed that when I open my m files, there are semicolons added where I certainly did not have them before. I've noticed it at the end of certain if statements and for statements. e.g. if aa is a vector, then
for a = aa
...
end
will be replaced with
for a = aa;
...
end
Does 2019B have the ability to edit your code without telling you? I'm not just talking auto-indenting as you type or anything like that. It actually seems to be editing the text of a file upon opening it such that the code is different than how you saved it. This is a bit disturbing...
It doesn't happen at all if/for statements. Weirdly, the Editor gives warnings about unnecessary semicolons in the cases where they have been added, so the auto-replacement doesn't seem to know what Editor knows.
댓글 수: 1
Rik
2019년 12월 17일
Are you sure it is the new Matlab release that is doing the editing? Were you able to find a work flow that reproduces this? It sounds like a serious bug to me if it is indeed Matlab that edits your code like this.
답변 (4개)
John D'Errico
2019년 12월 18일
편집: John D'Errico
2019년 12월 18일
R2019b here.
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.7.0.1216025 (R2019b) Update 1
As a test, I created this m-file. See the lack of a semi-colon. I then saved it.
function test(A)
A = rand(3)
end
Close the file. Then edit it, opening the file. Here it is:
function test(A)
A = rand(3)
end
No semi-colon added. MATLAB changed nothing.
댓글 수: 0
Steven Lord
2019년 12월 20일
I'm not aware of anything in MATLAB itself that I would expect to do this.
Do you have any add-ons installed? On the Home tab of the Toolstrip, click on the triangle below "Add-Ons" in the Environment section and select "Manage Add-Ons". What if anything does the Add-On Manager list other than MathWorks toolboxes?
Are you storing your files in a source control system? If so, which one?
How are you opening the files? Are you using the Open icon in the File section of the Home tab on the Toolstrip, are you using the edit function (and are you using the edit function included in MATLAB in that case), are you using some other function (one you've downloaded, were given, or wrote), etc.? If the latter, does that other function try to "beautify" your code (and eliminate Code Analyzer warnings) by adding the semicolons?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!