Image saved using pushbutton in MATLAB GUI cannot be displayed in destination folder

36 Views Asked by At

The image that i saved from my GUI into the destination folder cannot be displayed. The file is available in the folder but the image displayed is just a white canvas and not the image that I saved.Any idea as to why this happened?

1

There are 1 best solutions below

0
On BEST ANSWER

You are probably doing something wrong in the proper code. The "hold on" addition might solve your problem.

imshow(frameReference,'Border', 'tight',handles.figure1); hold on
plot(centroidsFiltered(:,2),centroidsFiltered(:,1),'g','LineWidth',1.5);
print(handles.figure1,'-r0','-dpng', 'figure.png');

This example works fine. You can also use the saveas function.

Since you are using a GUI, when you print the figure, you need to state the proper handler of the figure. Let's say handles.figure1. You just need to use that as reference.