Make plot appear in-line with text output when publishing
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 20 Sep 2017
Réponse apportée : MathWorks Support Team
le 29 Sep 2017
When I am publishing my script in MATLAB, I have code similar to the following:
plot(rand(1,5));
disp('Figure 1: A random plot');
When I publish this script, the figure is placed at the bottom of the section it is in, so the text appears above it. How can I get the figures to be displayed in-line with the other outputs?
Réponse acceptée
MathWorks Support Team
le 20 Sep 2017
This functionality can be achieved with the "snapnow" function, which forces a snapshot of an image for inclusion in the published document. The image appears in the published document at the end of the cell that contains the "snapnow" command. Take, for example, the following code:
for i = 1:3
figure;
plot(rand(1,5));
snapnow
disp(['Figure ' num2str(i)]);
end
When published, this will display the plots in-line with the corresponding text outputs.
More information about the "snapnow" function can be found on its documentation page, linked below:
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Function Creation dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!