How can I add figures from a looping script in the report generator toolbox?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Julio Martinez
el 20 de Abr. de 2015
Respondida: Rob Edgar
el 19 de Dic. de 2018
I have a script that plots 4 different figures with each loop. When running this program from the editor, all my figures appear in the right order. However, when I am in report generator mode, the figures are placed in a .doc document randomly, even though the figures appear in the right order when the report generator runs using part of the string that generates these plots.
Here's what I have tried in the report generator tree:
Report 'mynamereport'
Title page(child from report 'mynamereport')
Chapter 1 (child from report 'mynamereport')
%Evaluate Matlab expresion (child from Chapter 1) %this is where script runs loop and plots figures
FigureLoop 1 Chapter All (sibling from Chapter 1)
Figure Snapshot (child from FigureLoop 1)
%Evaluate Matlab Expression (child from Report'mynamereport') ends the process
Is there a way to have these plots in the report in the order that they are generated? Many thanks!
0 comentarios
Respuesta aceptada
Naty S
el 16 de Jul. de 2015
Hey This is a bit of a workaround. Ran a for loop from i=1:1:length(findobj('Type','figure')); Inside the for loop i used the figure(i) function to open the figure and than I snapped shot it.
Más respuestas (2)
Cindy Solomon
el 21 de Abr. de 2015
Hi Julio,
Similar to how "drawnow" works when plotting figures, there is an equivalent function for the MATLAB Report Generator called "snapnow". Adding this line after the plot call in your loop should resolve the issue. For more information on this function, see this doc link.
Hope this helps!
1 comentario
Julio Martinez
el 22 de Abr. de 2015
Editada: Julio Martinez
el 22 de Abr. de 2015
Rob Edgar
el 19 de Dic. de 2018
Someone at Mathworks figured this out for me. I was not having success with contourf plots in a loop working in report generator. The trick for me was getImpl. Without that, every iteration of fig2 was a duplicated of the first one I had added.
fig2 = Figure(f); fig2.SnapshotFormat = 'png';
fig2 = getImpl(fig2, rpt);
0 comentarios
Ver también
Categorías
Más información sobre Language Fundamentals en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!