WTH happened to "hold on all" in 2019b
조회 수: 1 (최근 30일)
이전 댓글 표시
figure;
plot(randn(10,2));
hold on all;
Error using hold (line 47)
First argument must be an axes object.
What happened to hold on all? That's so silly if you just removed it, why would I go back and change all my codes including it?
There is no problem on the 2019a.
댓글 수: 8
채택된 답변
추가 답변 (1개)
Rik
2019년 10월 10일
Nowhere in the documentation could I find any mention of hold on all being a valid syntax. Before R2014b on and all had a different effect, but this changed in HG2. See the release notes.
If hold on all ever did not error, its behavior was not documented, similar to how hold off on doesn't have a documented behavior. Apparently they only now put in an explicit check for the documented two input syntax hold(ax,state).
This recent change might be connected to a behavior change for ColorOrder and LineStyleOrder, see the release notes with a wider search.
If you choose to use undocumented code and it worked for at least more than 5 year, be happy. Some undocumented code breaks much sooner.
댓글 수: 3
Stephen23
2019년 10월 11일
편집: Stephen23
2019년 10월 11일
"I don't remember its specific purpose"
Nothing.
It never had a purpose (or atleast not for a very very long time).
I just checked MATLAB versions from R2009b to R2015b, and found that there are two ways that the hold code ignores more than one option:
- the code uses indexing to select the first option, and completely ignores any other options.
- Even if this were not the case, the code checks for 'on' before it checks for 'all', and once one option is matched any other options are simply ignored (if they even existed somehow in the relevant variable... which they don't at that point in the code).
So in reality, there has never been any point to using this undocumented snytax. So your code was and is equivalent to
hold on
"Why has it been working if it was a wrong statement for years/decades?"
Because code that does what it is documented to do is not the same thing as code that does not do anything undocumented. It is extremely hard to write code that has absolutely no undocumented evaluation paths, nor is such code likely to be easy to understand.
" it is just disappointing that it doesn't work in the new "
Because it never actually did anything, I don't see much reason for disappointment.
It seems that TMW just tightened up the input checking for unsupported, pointless syntaxes... which is probably a good thing.
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!