block plotting a figure
显示 更早的评论
Hi! I have a function A that calls other functions B, C, etc. Each function generates several plots, but in the end function A only plots one figure.
How can I not display the figure that function A generates without commenting on all the plots in the functions?
采纳的回答
更多回答(1 个)
Adam Danz
2022-12-28
1 个投票
This is a common problem which often arises from functions that produce sanity-check visualizations or other windows to underlying data along the analysis pipeline. It's a good practice and the plotting code should be kept around for future referencing.
To optionally prevent figures from being produced, you can set a logical flag that can be set to true/false at the top of your script or function that determines whether the figures will be produced.
Here are two answers to similar questions that explain the flag solution and other ideas:
类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!