WTH happened to "hold on all" in 2019b

8 views (last 30 days)
Baha411 on 10 Oct 2019
Commented: Stephen23 on 12 Oct 2019
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.
Baha411 on 10 Oct 2019
Sorry, I meant "hold on"

Sign in to comment.

Accepted Answer

Baha411 on 11 Oct 2019
I got an email regarding this from the technical support. For the sake of sharing the information, I am pasting it down here:
Thank you for the information. As noted in the documentation, "hold on" and "hold all" are the same. The "hold all" will be removed in a future release.
The command "hold on all" is equivalent to function syntax "hold('on','all')", which passes two arguments to the function "hold". The function "hold" is able to take two arguments, in which the first argument should be the axes object, and the second argument is either "on" or "off" (or "all"). In the example you provided, the function could not identify "on" as an axes object, that is why there is an error. Note that starting from MATLAB 2019b, the input checking is implemented.

More Answers (1)

Rik on 10 Oct 2019
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.
Baha411 on 11 Oct 2019
Thanks for your detailed explanation Stephen!

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!