MATLAB Answers

How to avoid Out of Memory (error code 00000006, return code 0) when using the print command?

5 views (last 30 days)
Gianluca Giracasa
Gianluca Giracasa on 27 Jun 2014
Commented: Geoff Hayes on 27 Jun 2014
I perform the following command after generating a figure :
print (gcf, '-dbitmap', [num2str(reg) '_' Name1 '.bmp'])
this works fine when I'm at work but when my computer is locked (I use a scheduled task) it generates the following error:
Warning: Failed in BitBlt, last error code 00000006, return code 0
> In C:\Program Files\MATLAB\R2014a\toolbox\matlab\graphics\hardcopy.p>hardcopy at 36
In graphics\private\render at 109
In print>LocalPrint at 276
In print at 233
In TTS_GEM at 42
Error using print>LocalPrint (line 291)
Out of memory. Type HELP MEMORY for your options.
Error in print (line 233)
Error in TTS_GEM (line 42)
print (gcf, '-dbitmap', [num2str(reg) '_' Name1 '.bmp'])
I read the following answer to a previous question in the forum:
The SAVEAS function uses the '-dbitmap' option to print, which works by performing a screen capture. Since the screen is locked, the data cannot be captured.
To work around this, use the PRINT command to save the figure as a BMP-file.
print (gcf, '-dbmp', 'myfile.bmp')
The point is that using '-dbmp' instead of '-dbitmap' doesn't yield the same results (the chart is unreadable).
How can I avoid this and be able to save a good quality chart when my computer is locked at night?

  1 Comment

Geoff Hayes
Geoff Hayes on 27 Jun 2014
Rather than saving the figure as a bitmap, perhaps try to save just the figure and (later, once the computer is unlocked) manually save the figure as a bitmap. See for usage of the savefig function.

Sign in to comment.

Answers (0)

Sign in to answer this question.