I have a live script that produces many plots, each on their own figure. For some reason a plot from the top portion of my live script is duplicated at the bottom of my script as well. It is really confusing me because I am directly calling out the figure number before every set of plot commands, so there should be no chance of plots appearing on the wrong figure.
The weirdest part is that if I put a breakpoint in where the phantom plot appears, run the live script to the breakpoint and then simply press continue, the phantom plot does not appear. So, the same exact code simply executed with a breakpoint does not cause the same issue to occur.
Are there certain plot features or functions that don't work properly in live script? Is there a recommended workflow for using figures in a live script? Am I not supposed to use the figure command at all?
I'm working with R2020b, but I have observed this problem several times in previous versions of MATLAB as well.
I can post the script if requested, but it has several associated simulink models and is quite lengthy.