I use to run some Matlab simulations on a HPC cluster.
The cluster runs SLURM.
One of the outputs of my Matlab script is a GIF file which shows the time evolution of what I am simulating. Every frame of the GIF file is obtained by means of the command "getframe", which takes a snapshot of the display.
When I run the Matlab script on my computer, the GIF file looks perfect, as the snapshot has the resolution of my computer. When I run the same Matlab script on the HPC cluster, submitting the job through SLURM, the GIF file looks bad, as it features a very low resolution. After all, the HPC cluster has not an actual display, maybe just a virtual display.
So, here is my question: can I change the resolution of the virtual display when I submit the job, so that the snapshots which Matlab takes during the simulation look high-resolution?
Try adding the following before the call to getframe
:
h = figure;
h.WindowState = 'maximized';
This will make sure the window is maximised before the snapshot is captured. You then should get a higher resolution image.
If that does not work, another option is to save each image to disk with print , where you can specify the resolution explicitly:
print('-dpng', '-r200', filename)
but then you will have to merge all the files in a movie in a subsequent step.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.