Plot not showing up for last section when publishing

조회 수: 20 (최근 30일)
Zoe Altenberg
Zoe Altenberg 2021년 4월 3일
편집: Sarah 2024년 2월 3일
I have two sections of code (each section starts with %%), they both have plots in them. When I go to publish, the first section shows the plot immediately after the section/block of code it corresponds to, but the second section doesn't produce the plot. It has something to do with the last section. I repeated the second block of code, so there were a total of 3 sections and the first two sections had plots after them but the last did not. When I run the script both/all plots are produced with no errors. In other words both code blocks are producing the right plots. It's just when I publish for some reason the last section doesn't produce a plot. I don't want to use snapnow because that puts the plots at the very end of the script and I want them to show up after their corresponding code.
Note: there is a section with a function at the very end – could this be affecting it?
  댓글 수: 2
Daniel Poiesz
Daniel Poiesz 2021년 4월 18일
I am having the exact same problem. I moved my code blocks around and it is always the last one that does not display its plots. The last line of code in each of my sections are the plots, so I don't think your function can be causing the problem. I also do not want to use snapnow becaus it places the plots at the end of the document and not in the proper section.
Daniel Poiesz
Daniel Poiesz 2021년 4월 18일
What is even more frustating is if I add a section at the end and plot a straight line then it works. I thought if the last one doesn't plot, then I will add a dummy plot. But then the section I was previously missing will plot followed by the dummy plot. So I can not even fool it into working.

댓글을 달려면 로그인하십시오.

답변 (2개)

Sarah
Sarah 2024년 2월 3일
편집: Sarah 2024년 2월 3일
Hello,
I had a similar issue. In my case, the last plot was taking too long to generate, so the publishing finished without it. I put in a pause() command for a few seconds after the last plot, and it was successfully displayed in the published pdf. Hope the fix helps anyone with this problem!

Uday Pradhan
Uday Pradhan 2021년 5월 26일
Hello,
The issue is not reproducible at my end. Could you share a snippet of code that reproduces the issue at your end? Also, please attach the MATLAB version number installed on your machine. Thanks.

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by