Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

How to: Copy/Print (sub)plots to clipboard and pdf

Asked by Hello kity

Hello kity (view profile)

on 5 Feb 2013

Hi

I would like to copy a (sub)plot to the clipboard and a pdf file

with and w/o the gui interface.

How can I do that?

thank you

1 Comment

Jan Simon

Jan Simon (view profile)

on 21 Mar 2013

What exactly is "the GUI interface"? Does it inlcude the window borders?

Hello kity

Hello kity (view profile)

Tags

Products

No products are associated with this question.

3 Answers

Answer by Hello kity

Hello kity (view profile)

on 5 Feb 2013
Edited by Hello kity

Hello kity (view profile)

on 5 Feb 2013

I allready found that one. But that is not really what I want. I have 3 subbplots and some edit/statit fields around it. Now it copys all of them at once then it is pretty much minimized when you copy paste it.

I d rather have the option to select the specific subpplot and edit/static fields on the figure.

0 Comments

Hello kity

Hello kity (view profile)

Answer by Ram

Ram (view profile)

on 20 Mar 2013

Try this. While you are generating the subplot, create a uicontextmenu for each axes that allows a right mouse click and choose to copy. Then, write the callback to copy using "print -dmeta" command.

% Commands to create uicontextmenus

for i = 1:length(justAxes)
      hcmenu = uicontextmenu;
      item = uimenu(hcmenu,'Label','Copy','Callback', @copy_call});
      set(justAxes(i),'uicontextmenu',hcmenu);
  end

% Now the copy_call function has to create a figure with that plot copied on it. Then upe "print -dmeta" command.

function copy_call(varargin)
     currAxes = get(get(get(varargin{1},'parent'),'parent'),'currentAxes');
     newFig = figure('visible','off');
     newHandle = copyobj(currAxes,newFig);
     print(newFig,'-dmeta');
     delete(newFig);

% Right mouse click on individual plots and choose the "copy" option. The "print -dmeta" command puts the plot in the clipboard. Use the paste command on to MS Word or other files.

0 Comments

Ram

Ram (view profile)

Contact us