Just a little trick that helps you get MATLAB figures easily into other programs by copying them to the clipboard. Could easily be made into a shortcut on the MATLAB toolbar.
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
As Doug stated above (comment #2), this works on Windows only. Also, you could read the help for PRINT, which specifies the -dmeta flag under the heading:
Good trick!
It’s a pity that the displaying quality of zoom-out figure is poorer than the one obtained by the operation “copy figure” in the menu of figuret.
Hello Doug! I’ve followed you at twitter and I’ve found many interesting MatLab tips. Thank you for sharing your knowledge with us! Keep posting!
Is there a way to do something similar on non-Windows platforms?
@Alan,
Thanks!
@Roy,
Nope, sorry!
Great jobs.
But if we have multi figure in one script file,How can we handle the clipboard?
>> print -dmeta ??? Error using ==> inputcheck>LocalCheckDevice at 250 Error using ==> inputcheck>LocalCheckDevice at 250 Illegal device option, '-dmeta', specified. Error in ==> inputcheck at 45 [ pj, devIndex ] = LocalCheckDevice( pj, cur_arg, devices ); Error in ==> print at 172 [pj, devices, options ] = inputcheck( pj, varargin{:} );My Mac version 10.4.8 and Matlab 7.5.0(R2007b)
What’s the problem the above?
@oh,
As Doug stated above (comment #2), this works on Windows only. Also, you could read the help for PRINT, which specifies the -dmeta flag under the heading:
Microsoft Windows system device driver options
@lzuxz,
The clipboard only supports one item on the stack at a time.
Doug
Good trick!
It’s a pity that the displaying quality of zoom-out figure is poorer than the one obtained by the operation “copy figure” in the menu of figuret.
Is there anyway to read the figure back from the clipboard into matlab?
@Lutfy,
What would it mean to ‘read the figure back from the clipboard into MATLAB’?
Doug
Is there a way to get
to preserve the figure color?
For example, the following creates a figure with a black background:
but the copied figure has a white background.
Thanks,
Dan
@Daniel,
Check on ‘inverthardcopy’.
Doug