Saving GUI plot to bitmap file without displaying Matlab figure

1 view (last 30 days)
Hi all. I have a question. I'm creating code for my company in Matlab (simulation tool), which generates data that can be visualized by e.g. contourf. This data should not be accessible to the end user. Since Matlab figures allow access to all data through the 'get' command, I have to go around making bitmap file directly instead of a figure file.
There is a twist, however, as I am using two GUI's. The main GUI opens a second GUI where the figures are plotted on according to the layout made with GUIDE. So in principle, I want the figure of the secondary GUI to be plotted directly as a bitmap. What would be the easiest way of doing this?
Tobias Elmøe
Tobias Elmøe on 18 Oct 2011
Good solution! That would work. Thanks! (I cannot select accept this answer, as it is written in the comments field, sorry).

Sign in to comment.

Answers (4)

Robert Cumming
Robert Cumming on 11 Oct 2011
I have a similar application in it I create postscript files using
print ( GUIHANDLE, '-dpsc', '', '-append', '-loose' )
(Note: this can be done with figure hidden), then I convery this PS file to a PDF file using
On PC: ps2pdf
On LINUX: use LINUX ghostscript.
The reason I picked PS was for vector graphics -> therefore you dont get "fuzzy" pictures or end up with really big files. Ofcourse the actual data iremains invisible to the end user.
FYI: I run this as a compiled exe with no GUI shown to the user. It is controlled/customised by the user through a control file (it runs in batch)

Grzegorz Knor
Grzegorz Knor on 10 Oct 2011
h = figure('Visible','off');

Malcolm Lidierth
Malcolm Lidierth on 11 Oct 2011
You could draw the figure using Java. The FEX has several examples using JFreeChart. The pic below shows one using a standard MATLAB example and the Project Waterloo Graphics Library - but that is not yet ready for distro I am afraid.
Walter Roberson
Walter Roberson on 24 Nov 2011

Sign in to comment.

Daniel Shub
Daniel Shub on 18 Oct 2011
"Since Matlab figures allow access to all data through the 'get' command, I have to go around making bitmap file directly instead of a figure file."
You could of course either compile your entire application or just compile the portion of the application that generates the bitmap.
I would bet that you could still extract the data from figures with visibility turned off that are only displayed for 1 line. Off the top of my head I would think that overloading the print command would make this pretty easy.


Find more on Migrate GUIDE Apps in Help Center and File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by