Duplicate live script figure appearing

조회 수: 33 (최근 30일)
Charles Refvem
Charles Refvem 2021년 4월 13일
답변: Arthi Sathyamurthi 2021년 5월 27일
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.

답변 (1개)

Arthi Sathyamurthi
Arthi Sathyamurthi 2021년 5월 27일
There are few possible reasons this might have happened in your case,
  1. Sometimes you might have initialized or created an object for the figure at the position where the phantom plot appears and. I assume due to certain initial conditions of your program during the first loop till your breakpoint, the phantom plot doesn’t appear when you run till the breakpoint. Check if you have initialized the figure and visualized it before updating the figure.
  2. In case you are using a loop, with the figure functions, run the loop with the breakpoint continuously and check if you are getting the phantom plot at some point which will help you rectify the problem.
In case, if the workarounds are not solving your problem, kindly post the script where you are facing this issue, which would be easier to reproduce the issue on our side and let you know the solution

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by