0

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

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

...

Undefined function or variable 'smapleimage'.   
Igor
  • 1,359
  • 19
  • 34
Fish123
  • 25
  • 1
  • 2
  • 6

1 Answers1

2

That's because smapleimage is numeric, while printdlg only accepts figure handles.

1) One may either create a matlab figure first (it might be hidden though)

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

2) ..or call some system tool, to print from command line, like this:

system('mspaint /pt image.png');

Other command-line printing options are discussed here: 1,2,3 .

Community
  • 1
  • 1
Igor
  • 1,359
  • 19
  • 34