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?

Print an image in Matlab GUI

Asked by Eric Letsolo

Eric Letsolo (view profile)

on 17 Nov 2012

How do you print an image from a printer in Matlab GUI? I get an error using the code below. Please help me.

   Undefined function or variable 'smapleimage'.
   smapleimage = imread('image.png');
   printdlg(handles.smapleimage) 

0 Comments

Eric Letsolo

Eric Letsolo (view profile)

Products

No products are associated with this question.

1 Answer

Answer by Arthur

Arthur (view profile)

on 17 Nov 2012

I guess it should be

smapleimage = imread('image.png');
printdlg(smapleimage) 

6 Comments

Arthur

Arthur (view profile)

on 17 Nov 2012

Ok, printdlg only accepts figure windows. Try this:

hFig = figure();
smapleimage = imread('image.png');
imshow(smapleimage)
printdlg(hFig) 
Eric Letsolo

Eric Letsolo (view profile)

on 17 Nov 2012

I can print a figure using printdlg(handles.Fig) Is it possible to print out an image from Matlab GUI

Arthur

Arthur (view profile)

Contact us